After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 793715 - rtspsrc: regression with streams marked as recvonly
rtspsrc: regression with streams marked as recvonly
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal blocker
: 1.13.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 793964
 
 
Reported: 2018-02-22 10:22 UTC by Tim-Philipp Müller
Modified: 2018-03-13 14:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Hikvision ONVIF IP Camera (320 bytes, application/x-compressed-tar)
2018-02-22 23:23 UTC, Mandar Joshi
  Details
hikvision.pcapng.gz (1.50 MB, application/gzip)
2018-03-01 09:31 UTC, Mandar Joshi
  Details
rtspsrc: Ignore sendonly/recvonly attributes unless a backchannel is configured (1.44 KB, patch)
2018-03-01 16:16 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Tim-Philipp Müller 2018-02-22 10:22:51 UTC
<mndar> Thanks for your tip yesterday about the GStreamer not detecting RTSP camera stream. Turns out this line is causing the problem. Disregarding that condition the camera stream works. In gstrtspsrc.c, "gst_sdp_media_get_attribute_val (media, "recvonly") != NULL" was causing that problem. I see that the 'if' condition has changed in git master 

https://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/gst/rtsp/gstrtspsrc.c#n1775

(log files were pasted to pastebin but pages expired now)
Comment 1 Sebastian Dröge (slomo) 2018-02-22 17:21:57 UTC
What is this camera? ONVIF, and following the wrong example in the specification and mixing up the sendonly/recvonly attributes and contradicting the RFCs that define the attributes?

We might have to add some detection for ONVIF to rtspsrc for switching between both, or a property.

Can you provide a dump of the RTSP stream with that camera?
Comment 2 Tim-Philipp Müller 2018-02-22 17:25:04 UTC
Can/should we detect in advance if there are backchannels in the SDP and ignore recvonly/sendonly attributes if there's no mix?
Comment 3 Mandar Joshi 2018-02-22 23:23:18 UTC
Created attachment 368805 [details]
Hikvision ONVIF IP Camera
Comment 4 Mandar Joshi 2018-02-22 23:25:40 UTC
The camera stream correctly in 1.12.4
GStreamer 1.13.1 does not have '!stream->is_backchannel' in that 'if' condition. I have attached the Wireshark dump of the IP camera.

Here is the SDP received

v=0
o=- 1519236923460104 1519236923460104 IN IP4 10.168.1.64
s=Media Presentation
e=NONE
b=AS:5050
t=0 0
a=control:rtsp://10.168.1.64:554/Streaming/Channels/101/?transportmode=unicast&profile=Profile_1
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:5000
a=recvonly
a=x-dimensions:1920,1080
a=control:rtsp://10.168.1.64:554/Streaming/Channels/101/trackID=1?transportmode=unicast&profile=Profile_1
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=420029; packetization-mode=1; sprop-parameter-sets=Z00AKpWoHgCJ+WEAAAcIAAFfkAQ=,aO48gA==
a=Media_header:MEDIAINFO=494D4B48010200000400000100000000000000000000000000000000000000000000000000000000;
a=appversion:1.0
Comment 5 Sebastian Dröge (slomo) 2018-02-23 06:16:03 UTC
Ok, so the camera is doing it exactly wrong. The way how it is wrongly given in the examples in the ONVIF spec.

I guess we have to implement some kind of heuristic then. As a first step what Tim said, but for cases where there are both directions we need to be more clever.

This also means that a property is needed in gst-rtsp-server to work with both kinds of ONVIF clients: broken like this one and correct like rtspsrc currently.
Comment 6 Tim-Philipp Müller 2018-02-23 09:25:35 UTC
Another heuristic we can do: check what the video stream(s) are tagged with.
Comment 7 Sebastian Dröge (slomo) 2018-02-27 07:30:14 UTC
(In reply to Tim-Philipp Müller from comment #6)
> Another heuristic we can do: check what the video stream(s) are tagged with.

In theory there could also be a video backchannel. Not in the current ONVIF spec though.
Comment 8 Sebastian Dröge (slomo) 2018-03-01 08:47:03 UTC
(In reply to Mandar Joshi from comment #3)
> Created attachment 368805 [details]
> Hikvision ONVIF IP Camera

This can't be opened in wireshark btw, and 107 bytes seems a bit small :)
Comment 9 Mandar Joshi 2018-03-01 09:31:04 UTC
Created attachment 369138 [details]
hikvision.pcapng.gz

Please try this file
Comment 10 Sebastian Dröge (slomo) 2018-03-01 10:04:15 UTC
Thanks, so exactly the problem as expected and nothing could be done about it other than implement heuristics that will fall apart in other cases, or a property.

Let's think about this a bit more
Comment 11 Sebastian Dröge (slomo) 2018-03-01 15:48:35 UTC
One complication for heuristics here is that it is completely valid (and AFAIU the ONVIF testsuite checks for that) to *only* have a backchannel. So if we see a single audio stream that is recvonly (or sendonly), we can't know whether it is a backchannel or a single audio stream.

I would suggest that for 1.14 we ignore the attributes completely unless a backchannel is requested on rtspsrc. If a backchannel is requested, we follow the RFC and not the broken examples in the ONVIF spec, which would then still fail with cameras like this one here though.

For 1.16 we can hopefully come up with a better solution. I think ideally I'd like to always look at the attributes, and if we need workarounds for broken hardware out there we can always add a property for that.
Comment 12 Sebastian Dröge (slomo) 2018-03-01 16:16:39 UTC
Created attachment 369148 [details] [review]
rtspsrc: Ignore sendonly/recvonly attributes unless a backchannel is configured

This works around a bug in various ONVIF cameras that implement the
attributes the wrong way around. They still won't work with a
backchannel but at least normal playback will work for the time being.
It restores pre-1.14 behaviour where we would fail to preroll on any SDP
that lists a recvonly stream. For 1.16 a better solution should be
found.

The problem here is that the ONVIF spec has the meaning of the two
attributes the wrong way around in the examples, compared to RFC4566.
Comment 13 Sebastian Dröge (slomo) 2018-03-01 16:18:05 UTC
Please someone test this with such a broken ONVIF camera. I'd merge this for 1.14 for now and open a new bug for 1.16 so that we can find a better solution. This now simply restores pre-1.14 behaviour.
Comment 14 Sebastian Dröge (slomo) 2018-03-01 18:28:10 UTC
Attachment 369148 [details] pushed as f29fe76 - rtspsrc: Ignore sendonly/recvonly attributes unless a backchannel is configured
Comment 15 Mandar Joshi 2018-03-01 22:26:07 UTC
Thanks Sebastian, the Hikvision camera works now.
Comment 16 Sebastian Dröge (slomo) 2018-03-13 14:05:44 UTC
Also reverted in 1.12 for 1.12.5