[gst-cvs] gst-plugins-good: rtph264depay: only set delta unit on all-non-key units

Wim Taymans wtay at kemper.freedesktop.org
Mon Nov 1 08:00:21 PDT 2010


Module: gst-plugins-good
Branch: master
Commit: 706731b331c2aa77b6e3d58d7eb72ebdcdb4ee1b
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=706731b331c2aa77b6e3d58d7eb72ebdcdb4ee1b

Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Mon Nov  1 14:56:28 2010 +0100

rtph264depay: only set delta unit on all-non-key units

Only set the delta flag when all of the units in the packet are delta units.
Based on patch from Olivier Crête <olivier.crete at collabora.co.uk>

Fixes #632945

---

 gst/rtp/gstrtph264depay.c |   22 +++++++++++-----------
 gst/rtp/gstrtph264depay.h |    2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c
index 697d818..c63087e 100644
--- a/gst/rtp/gstrtph264depay.c
+++ b/gst/rtp/gstrtph264depay.c
@@ -413,7 +413,7 @@ gst_rtp_h264_depay_handle_nal (GstRtpH264Depay * rtph264depay, GstBuffer * nal,
   guint8 *data;
   GstBuffer *outbuf = NULL;
   GstClockTime out_timestamp;
-  gboolean delta, out_delta;
+  gboolean keyframe, out_keyframe;
 
   size = GST_BUFFER_SIZE (nal);
   if (G_UNLIKELY (size < 5))
@@ -424,9 +424,9 @@ gst_rtp_h264_depay_handle_nal (GstRtpH264Depay * rtph264depay, GstBuffer * nal,
   nal_type = data[4] & 0x1f;
   GST_DEBUG_OBJECT (rtph264depay, "handle NAL type %d", nal_type);
 
-  delta = !NAL_TYPE_IS_KEY (nal_type);
+  keyframe = NAL_TYPE_IS_KEY (nal_type);
 
-  out_delta = delta;
+  out_keyframe = keyframe;
   out_timestamp = in_timestamp;
 
   if (rtph264depay->merge) {
@@ -460,9 +460,9 @@ gst_rtp_h264_depay_handle_nal (GstRtpH264Depay * rtph264depay, GstBuffer * nal,
       outbuf = gst_adapter_take_buffer (rtph264depay->picture_adapter, outsize);
 
       out_timestamp = rtph264depay->last_ts;
-      out_delta = rtph264depay->last_delta;
+      out_keyframe = rtph264depay->last_keyframe;
 
-      rtph264depay->last_delta = FALSE;
+      rtph264depay->last_keyframe = FALSE;
       rtph264depay->picture_start = FALSE;
     }
 
@@ -470,7 +470,7 @@ gst_rtp_h264_depay_handle_nal (GstRtpH264Depay * rtph264depay, GstBuffer * nal,
     GST_DEBUG_OBJECT (depayload, "adding NAL to picture adapter");
     gst_adapter_push (rtph264depay->picture_adapter, nal);
     rtph264depay->last_ts = in_timestamp;
-    rtph264depay->last_delta |= delta;
+    rtph264depay->last_keyframe |= keyframe;
     rtph264depay->picture_start |= start;
   } else {
     /* no merge, output is input nal */
@@ -484,16 +484,16 @@ gst_rtp_h264_depay_handle_nal (GstRtpH264Depay * rtph264depay, GstBuffer * nal,
       GST_DEBUG_OBJECT (depayload, "prepending codec_data");
       outbuf = gst_buffer_join (rtph264depay->codec_data, outbuf);
       rtph264depay->codec_data = NULL;
-      out_delta = FALSE;
+      out_keyframe = TRUE;
     }
     outbuf = gst_buffer_make_metadata_writable (outbuf);
 
     GST_BUFFER_TIMESTAMP (outbuf) = out_timestamp;
 
-    if (out_delta)
-      GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
-    else
+    if (out_keyframe)
       GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
+    else
+      GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
 
     gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
 
@@ -782,7 +782,7 @@ gst_rtp_h264_depay_change_state (GstElement * element,
       rtph264depay->wait_start = TRUE;
       gst_adapter_clear (rtph264depay->picture_adapter);
       rtph264depay->picture_start = FALSE;
-      rtph264depay->last_delta = FALSE;
+      rtph264depay->last_keyframe = FALSE;
       break;
     default:
       break;
diff --git a/gst/rtp/gstrtph264depay.h b/gst/rtp/gstrtph264depay.h
index 17d001a..e801f1f 100644
--- a/gst/rtp/gstrtph264depay.h
+++ b/gst/rtp/gstrtph264depay.h
@@ -55,7 +55,7 @@ struct _GstRtpH264Depay
   GstAdapter *picture_adapter;
   gboolean    picture_start;
   GstClockTime last_ts;
-  gboolean    last_delta;
+  gboolean    last_keyframe;
 };
 
 struct _GstRtpH264DepayClass





More information about the Gstreamer-commits mailing list