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 758169 - rtph264depay should translate "a-framerate (string)" attribute to "framerate (fraction)" on certain cameras
rtph264depay should translate "a-framerate (string)" attribute to "framerate ...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.4.4
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-11-16 11:32 UTC by Jan Spurny
Modified: 2018-11-03 15:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rtpbasedepayload: set max-framerate if a-framerate is passed via caps (4.34 KB, patch)
2015-11-17 08:43 UTC, Hyunjun Ko
none Details | Review
rtpbasedepayload: set max-framerate if a-framerate is passed via caps (2.54 KB, patch)
2015-11-17 08:44 UTC, Hyunjun Ko
none Details | Review
rtpbasedepayload: set max-framerate if a-framerate is passed via caps (3.03 KB, patch)
2015-11-18 01:56 UTC, Hyunjun Ko
none Details | Review
rtpjpegdepay: Parse a-framerate using gst_util_double_to_fraction (1.67 KB, patch)
2015-11-18 02:03 UTC, Hyunjun Ko
none Details | Review
rtpbasedepayload: set max-framerate if a-framerate is passed via caps (2.91 KB, patch)
2015-11-24 05:35 UTC, Hyunjun Ko
none Details | Review

Description Jan Spurny 2015-11-16 11:32:02 UTC
When playing h264 streams from Sony SNC-VB600 and FLIR FC-690-PAL cameras, the rtph264depay will receive caps containing "a-framerate" attribute, which contains string value, for example "12.0", but rtph264depay does not recognize it and reports "framerate=(fraction)0/1" on src pad, so the whole pipeline downstream has "0/1" framerate, which means "variable bitrate" according to documentation.

I believe that rtph264depay could translate the nonstandard "a-framerate" to "framerate", so the caps downstream would report correct framerate when it is in fact known, instead of reporting a variable framerate (0/1), which is not true.

If someone has access to cameras mentioned above (and I think it's safe to assume that probably all contemporary Sony and FLIR cameras will exhibit the same behaviour), you can check using simple pipeline:

    gst-launch-1.0 rtspsrc location=rtsp://<addr> ! decodebin ! xvimagesink

This is the log record where "a-framerate" is first mentioned:

    DEBUG rtspsrc gstrtspsrc.c:1892:gst_rtspsrc_sdp_attributes_to_caps: adding caps: a-framerate=12.0


and from there, every other element has "framerate=0/1" in caps.

For additional info, see bug 758023
Comment 1 Olivier Crête 2015-11-16 19:32:28 UTC
It really should be "max-framerate", as RFC 4566 defines it as "This gives the maximum video frame rate in frames/sec." And we should probably do that in the rtpbasedepayload base class for all video/ output formats.
Comment 2 Hyunjun Ko 2015-11-17 08:43:06 UTC
Created attachment 315730 [details] [review]
rtpbasedepayload: set max-framerate if a-framerate is passed via caps

IMHO, this patch might be a solution.
Comment 3 Hyunjun Ko 2015-11-17 08:44:45 UTC
Created attachment 315731 [details] [review]
rtpbasedepayload: set max-framerate if a-framerate is passed via caps

Sorry there was a mistake
Comment 4 Olivier Crête 2015-11-17 17:16:41 UTC
Review of attachment 315731 [details] [review]:

Generally looks good, just a few little things.

::: gst-libs/gst/rtp/gstrtpbasedepayload.c
@@ +279,3 @@
+      return;
+  } else
+    return;

if (media == NULL || g_strcmp0 (media, "video"))
  return;

@@ +282,3 @@
+
+  src_caps = gst_pad_get_current_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (filter));
+  if (!src_caps)

if (!src_caps || !gst_caps_is_fixed (src_caps))
  return;

Should probably also check if framerate or max-framerate is already there in the src caps.

@@ +285,3 @@
+    return;
+
+  a_framerate = gst_structure_get_string (caps_struct, "a-framerate");

Can you also check for x-framerate, I've heard some people mistakenly use that.

@@ +301,3 @@
+
+    fps_num = gst_value_get_fraction_numerator (&dest);
+    fps_denom = gst_value_get_fraction_denominator (&dest);

You can avoid the annoying GValue using gst_util_double_to_fraction()
Comment 5 Hyunjun Ko 2015-11-18 01:56:34 UTC
Created attachment 315796 [details] [review]
rtpbasedepayload: set max-framerate if a-framerate is passed via caps

Following Olivier's review, thanks to Olivier :)
And fix minor leaks.
Comment 6 Hyunjun Ko 2015-11-18 02:03:12 UTC
Created attachment 315797 [details] [review]
rtpjpegdepay: Parse a-framerate using gst_util_double_to_fraction

For consistency and simplification, we can adjust this patch.
Comment 7 Luis de Bethencourt 2015-11-23 20:00:15 UTC
Review of attachment 315796 [details] [review]:

Nit: there are 4 instances of

gst_caps_unref (src_caps);
return;

You could make that a goto at the end of the function.
Comment 8 Hyunjun Ko 2015-11-24 05:35:41 UTC
Created attachment 316133 [details] [review]
rtpbasedepayload: set max-framerate if a-framerate is passed via caps

Following Luis's review.
Thanks Luis :)
Comment 9 Víctor Manuel Jáquez Leal 2017-06-09 09:27:28 UTC
Any other comment about these patches? Can I push them?
Comment 10 GStreamer system administrator 2018-11-03 15:06:01 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/238.