From 909c23c38bda1abd0c86b597d6c300d43e8849f8 Mon Sep 17 00:00:00 2001 From: Jon Burgess Date: Sat, 19 Mar 2016 14:50:44 +0000 Subject: [PATCH] ONVIF: Make GetStreamUri try both RTP_unicast and RTP-Unicast The specification gives conflicting values for the unicast stream type in different parts of the document: http://www.onvif.org/onvif/ver10/media/wsdl/media.wsdl#op.GetStreamUri Description has: StreamType = "RTP_unicast" Input has: enum { 'RTP-Unicast', 'RTP-Multicast' } The Tenvis TH661 only accepts RTP-Unicast but the original code was using RTP_unicast. Try both and take the result of the first one which works. --- onvif/scripts/zmonvif-probe.pl | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/onvif/scripts/zmonvif-probe.pl b/onvif/scripts/zmonvif-probe.pl index ed81e3961..5351ede6a 100755 --- a/onvif/scripts/zmonvif-probe.pl +++ b/onvif/scripts/zmonvif-probe.pl @@ -232,16 +232,21 @@ sub profiles $profile->get_VideoEncoderConfiguration()->get_RateControl()->get_FrameRateLimit() . ", "; - $result = $client->get_endpoint('media')->GetStreamUri( { - StreamSetup => { # ONVIF::Media::Types::StreamSetup - Stream => 'RTP_unicast', # StreamType - Transport => { # ONVIF::Media::Types::Transport - Protocol => 'RTSP', # TransportProtocol - }, - }, - ProfileToken => $token, # ReferenceToken - } ,, ); - die $result if not $result; + # 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' ) { + $result = $client->get_endpoint('media')->GetStreamUri( { + StreamSetup => { # ONVIF::Media::Types::StreamSetup + Stream => $streamtype, # StreamType + Transport => { # ONVIF::Media::Types::Transport + Protocol => 'RTSP', # TransportProtocol + }, + }, + ProfileToken => $token, # ReferenceToken + } ,, ); + last if $result; + } + die $result if not $result; # print $result . "\n"; print $result->get_MediaUri()->get_Uri() .