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 609658 - [rtph264depay] doesn't mark output frames as keyframes correctly
[rtph264depay] doesn't mark output frames as keyframes correctly
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.16
Other Linux
: Normal normal
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-02-11 15:38 UTC by Miguel Angel Cabrera Moya
Modified: 2010-04-30 14:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add interframe detection (499 bytes, patch)
2010-02-12 10:58 UTC, Miguel Angel Cabrera Moya
rejected Details | Review
Patch that probably adds all cases for keyframe detection (1.41 KB, patch)
2010-02-19 10:15 UTC, Miguel Angel Cabrera Moya
none Details | Review
Add keyframe and delta frame recognition (1.41 KB, patch)
2010-03-05 10:31 UTC, Miguel Angel Cabrera Moya
none Details | Review
DELTA_UNIT marking of output buffers (3.78 KB, patch)
2010-04-15 10:24 UTC, Mark Nauwelaerts
none Details | Review
DELTA_UNIT marking of output buffers (4.89 KB, patch)
2010-04-16 11:01 UTC, Mark Nauwelaerts
none Details | Review
DELTA_UNIT marking of output buffers (5.06 KB, patch)
2010-04-20 09:25 UTC, Mark Nauwelaerts
committed Details | Review

Description Miguel Angel Cabrera Moya 2010-02-11 15:38:48 UTC
Doesn't mark output frames as keyframes correctly.
Comment 1 Miguel Angel Cabrera Moya 2010-02-12 10:58:00 UTC
Created attachment 153617 [details] [review]
Add interframe detection

Probably this patch doesn't cover all cases.
Comment 2 Miguel Angel Cabrera Moya 2010-02-19 10:15:31 UTC
Created attachment 154192 [details] [review]
Patch that probably adds all cases for keyframe detection
Comment 3 Miguel Angel Cabrera Moya 2010-02-19 10:16:08 UTC
Review of attachment 153617 [details] [review]:

Substituted by a new one.
Comment 4 Miguel Angel Cabrera Moya 2010-03-05 10:31:15 UTC
Created attachment 155292 [details] [review]
Add keyframe and delta frame recognition

There was a bug in the last patch.
Comment 5 Mark Nauwelaerts 2010-04-15 10:24:18 UTC
Created attachment 158802 [details] [review]
DELTA_UNIT marking of output buffers

Provided patches missed out on marking of merged output buffers, i.e. when operating in access-unit output mode, which is a case where delta/key makes most sense.

Attached patch takes care of that case as well, and modifies/refactors the other cases, and should as such cover the intended.
Comment 6 Tim-Philipp Müller 2010-04-16 10:17:43 UTC
Review of attachment 158802 [details] [review]:

Is this something we should get into the release as well?

::: gst/rtp/gstrtph264depay.c
@@ +418,3 @@
+    return FALSE;
+
+  nal_unit_type = (GST_BUFFER_DATA (nal))[4] & 0x1f;

Doesn't this mean we should check for GST_BUFFER_SIZE (nal) < 5 above?

@@ +422,3 @@
+  /* non-IDR VCL layer NAL considered DELTA */
+  if (nal_unit_type >= 1 && nal_unit_type <= 4) {
+    GST_BUFFER_FLAG_SET (nal, GST_BUFFER_FLAG_DELTA_UNIT);

Can we assume the buffer metadata is always writable? (Do we know the return value of _take_buffer() is always metadata-writable?)
Comment 7 Mark Nauwelaerts 2010-04-16 10:30:40 UTC
(In reply to comment #6)
> Review of attachment 158802 [details] [review]:
> 
> Is this something we should get into the release as well?
> 

I would not mind, probably does not hurt (unless some decoders or so turn out to be very picky w.r.t. flags).

> ::: gst/rtp/gstrtph264depay.c
> @@ +418,3 @@
> +    return FALSE;
> +
> +  nal_unit_type = (GST_BUFFER_DATA (nal))[4] & 0x1f;
> 
> Doesn't this mean we should check for GST_BUFFER_SIZE (nal) < 5 above?

Right.

> 
> @@ +422,3 @@
> +  /* non-IDR VCL layer NAL considered DELTA */
> +  if (nal_unit_type >= 1 && nal_unit_type <= 4) {
> +    GST_BUFFER_FLAG_SET (nal, GST_BUFFER_FLAG_DELTA_UNIT);
> 
> Can we assume the buffer metadata is always writable? (Do we know the return
> value of _take_buffer() is always metadata-writable?)

Probably not in general, but one would hope/expect so in this case, since we are taking everything that is in the adapter (and have put _new_and_alloc buffers into it), but a gst_buffer_make_metadata_writable can be added for good measure.
Comment 8 Mark Nauwelaerts 2010-04-16 11:01:16 UTC
Created attachment 158882 [details] [review]
DELTA_UNIT marking of output buffers

Revised version with a few tweaks and comments incorporated.
Comment 9 Miguel Angel Cabrera Moya 2010-04-16 14:53:59 UTC
I really don't know about the inners of the rtp depayloader.

But i think it is easier to test for delta_unit and mark just before the "return" when the h264 frame is complete. Even in the case they are received fragmented, testing and marking just before the "return" will work, i think.
Comment 10 Mark Nauwelaerts 2010-04-20 09:25:37 UTC
Created attachment 159146 [details] [review]
DELTA_UNIT marking of output buffers

Yet a few other tweaks in the merging case.

(Btw, as mentioned above, this all pretty much marks the buffer just before return in the non-merge case, and uses appropriate caution in the merge case.)
Comment 11 Mark Nauwelaerts 2010-04-30 14:32:45 UTC
commit 6bf7f5cfd3d7bf5e9bd923bad948fa45ca795d72
Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Date:   Thu Apr 15 12:21:56 2010 +0200

    rtph264depay: DELTA_UNIT marking of output buffers

    ... which evidently makes (most) sense if output buffers are
    actually frames.

    Partially based on a patch by
    Miguel Angel Cabrera <mad_aluche at hotmail.com>

    Fixes #609658.