Make onvif handle no resolution graceully

This commit is contained in:
Isaac Connor 2020-05-05 18:07:12 -04:00
parent d281d2243c
commit ac31abd30c
1 changed files with 11 additions and 6 deletions

View File

@ -279,13 +279,11 @@ sub profiles {
if ( $verbose ) {
print "Received message:\n" . $result . "\n";
}
my @profiles;
my $profiles = $result->get_Profiles();
foreach my $profile ( @{ $profiles } ) {
foreach my $profile ( @{ $result->get_Profiles() } ) {
my $token = $profile->attr()->get_token() ;
my $Name = $profile->get_Name();
my $VideoEncoderConfiguration = $profile->get_VideoEncoderConfiguration();
if ( ! $VideoEncoderConfiguration ) {
@ -293,6 +291,9 @@ sub profiles {
next;
}
my $token = $profile->attr()->get_token() ;
my $Name = $profile->get_Name();
# Specification gives conflicting values for unicast stream types, try both.
# http://www.onvif.org/onvif/ver10/media/wsdl/media.wsdl#op.GetStreamUri
foreach my $streamtype ( 'RTP_unicast', 'RTP-Unicast', 'RTP-multicast', 'RTP-Multicast' ) {
@ -310,12 +311,16 @@ sub profiles {
next if ! $MediaUri;
my $Uri = $MediaUri->get_Uri();
next if ! $Uri;
my $Resolution = $VideoEncoderConfiguration->get_Resolution();
my $Width = $Resolution ? $Resolution->get_Width() : 0;
my $Height = $Resolution ? $Resolution->get_Height() : 0;
push @profiles, {
print join(', ', $token,
$Name,
$VideoEncoderConfiguration->get_Encoding(),
$VideoEncoderConfiguration->get_Resolution()->get_Width(),
$VideoEncoderConfiguration->get_Resolution()->get_Height(),
$Width,
$Height,
$VideoEncoderConfiguration->get_RateControl()->get_FrameRateLimit(),
$Uri,
) . "\n";