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 793284 - h264parses: Expose framerate even if the fixed_frame_rate flag isn't set
h264parses: Expose framerate even if the fixed_frame_rate flag isn't set
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: 1.13.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-02-07 21:29 UTC by Nicolas Dufresne (ndufresne)
Modified: 2018-08-27 10:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Dumped SPS of the sample stream (4.36 KB, text/plain)
2018-02-07 21:29 UTC, Nicolas Dufresne (ndufresne)
  Details
h264parser: Expose framerate even if fixed_frame_rate flag isn't set (1.19 KB, patch)
2018-02-07 21:32 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review
baseparse: Fix check for update_interval (1.21 KB, patch)
2018-02-22 03:26 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review
baseparse: Avoid overflow in update_interval calculation (1.17 KB, patch)
2018-02-22 03:26 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review
baseparse: Fix integer overflow in bitrate calculation (2.29 KB, patch)
2018-02-22 03:26 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review
gl: Add meson support for GBM backend (3.77 KB, patch)
2018-02-23 22:14 UTC, Nicolas Dufresne (ndufresne)
none Details | Review

Description Nicolas Dufresne (ndufresne) 2018-02-07 21:29:02 UTC
Created attachment 368101 [details]
Dumped SPS of the sample stream

I've came accross a test H264 byte-stream and was surprised to find out the ffmpeg could make up a framerate where GStreamer could not. I've attached the SPS dump, one can notice that fixed_frame_rate_flag is not set. After going through the spec, it seems that this flags has an implication on the decoder processing of interleaved content, but it's not stated anywhere that the framerate value is not valid.

All in all, I think FFMPEG is right, we should consider this framerate.
Comment 1 Nicolas Dufresne (ndufresne) 2018-02-07 21:32:05 UTC
Created attachment 368102 [details] [review]
h264parser: Expose framerate even if fixed_frame_rate flag isn't set

There is nothing in the spec that state that framerate is not valid in
that case. This aligns GStreamer with FFMPEG behaviour for similar
streams.
Comment 2 Nicolas Dufresne (ndufresne) 2018-02-21 21:32:03 UTC
Attachment 368102 [details] pushed as 4300611 - h264parser: Expose framerate even if fixed_frame_rate flag isn't set
Comment 3 Nicolas Dufresne (ndufresne) 2018-02-22 03:26:37 UTC
Created attachment 368740 [details] [review]
baseparse: Fix check for update_interval

update_interval may be -1
Comment 4 Nicolas Dufresne (ndufresne) 2018-02-22 03:26:42 UTC
Created attachment 368741 [details] [review]
baseparse: Avoid overflow in update_interval calculation
Comment 5 Nicolas Dufresne (ndufresne) 2018-02-22 03:26:46 UTC
Created attachment 368742 [details] [review]
baseparse: Fix integer overflow in bitrate calculation
Comment 6 Nicolas Dufresne (ndufresne) 2018-02-22 03:30:47 UTC
Those 3 patches against baseparse fixes buffer overflows that would lead to assertions. It fixes gst-plugins-bad elements_h264parse unit test that was failing after this change. The reason is that the test SPS contains a really high framerate (1000000000 fps). I think it's a good test, so I left it like this. I'll review myself tomorrow before merging, other's review is of course welcome.
Comment 7 Nicolas Dufresne (ndufresne) 2018-02-22 21:16:39 UTC
Attachment 368740 [details] pushed as 25aed8c - baseparse: Fix check for update_interval
Attachment 368741 [details] pushed as a84b886 - baseparse: Avoid overflow in update_interval calculation
Attachment 368742 [details] pushed as 91798e1 - baseparse: Fix integer overflow in bitrate calculation
Comment 8 Nicolas Dufresne (ndufresne) 2018-02-23 22:14:15 UTC
Created attachment 368861 [details] [review]
gl: Add meson support for GBM backend

https://bugzilla.gnome.org/show_bug.cgi?id=782923
Comment 9 Tim-Philipp Müller 2018-02-23 23:19:42 UTC
(In reply to Nicolas Dufresne (stormer) from comment #8)
> Created attachment 368861 [details] [review] [review]
> gl: Add meson support for GBM backend
> 
> https://bugzilla.gnome.org/show_bug.cgi?id=782923

Wrong bug ? :)
Comment 10 Nicolas Dufresne (ndufresne) 2018-02-24 01:53:10 UTC
Outch
Comment 11 Philippe Normand 2018-08-27 10:04:11 UTC
Review of attachment 368742 [details] [review]:

::: libs/gst/base/gstbaseparse.c
@@ +1819,3 @@
+        8 * parse->priv->data_bytecount, parse->priv->acc_duration);
+
+    if (avg_bitrate > G_MAXUINT)

Shouldn't this be a G_MAXINT? avg_bitrate is a gint, not guint.
This is causing an assert here in  with the following command:

youtube-dl "https://vimeo.com/280481143" -o - | G_DEBUG=fatal_criticals  gst-play-1.0 fd://0

(gdb) bt
  • #0 0x00007f82625ebc41 in
  • #1 g_logv
  • #2 g_log
  • #3 _gst_util_uint64_scale_int
    at ../subprojects/gstreamer/gst/gstutils.c line 680
  • #4 gst_base_parse_update_bitrates
    at ../subprojects/gstreamer/libs/gst/base/gstbaseparse.c line 1918
  • #5 gst_base_parse_push_frame
    at ../subprojects/gstreamer/libs/gst/base/gstbaseparse.c line 2513
  • #6 gst_base_parse_handle_and_push_frame
    at ../subprojects/gstreamer/libs/gst/base/gstbaseparse.c line 2395
  • #7 gst_base_parse_finish_frame
    at ../subprojects/gstreamer/libs/gst/base/gstbaseparse.c line 2739
  • #8 gst_h264_parse_handle_frame
    at ../subprojects/gst-plugins-bad/gst/videoparsers/gsth264parse.c line 1276
  • #9 gst_base_parse_handle_buffer
    at ../subprojects/gstreamer/libs/gst/base/gstbaseparse.c line 2203
  • #10 gst_base_parse_chain
    at ../subprojects/gstreamer/libs/gst/base/gstbaseparse.c line 3288
  • #11 gst_pad_chain_data_unchecked
    at ../subprojects/gstreamer/gst/gstpad.c line 4322
  • #12 gst_pad_push_data
    at ../subprojects/gstreamer/gst/gstpad.c line 4578
  • #13 gst_pad_push
    at ../subprojects/gstreamer/gst/gstpad.c line 4697
  • #14 gst_single_queue_push_one
    at ../subprojects/gstreamer/plugins/elements/gstmultiqueue.c line 1643
  • #15 gst_multi_queue_loop
    at ../subprojects/gstreamer/plugins/elements/gstmultiqueue.c line 1963
  • #16 gst_task_func
    at ../subprojects/gstreamer/gst/gsttask.c line 328
  • #17 0x00007f826260e7d0 in
  • #18 0x00007f826260de05 in
  • #19 start_thread
    at pthread_create.c line 463
  • #20 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 95