matroskademux: mark invisible VP8 frames with the DECODE_ONLY flag
authorAlexey Fisher <bug-track@fisher-privat.net>
Sat, 27 Oct 2012 12:24:24 +0000 (13:24 +0100)
committerTim-Philipp Müller <tim@centricular.net>
Sat, 27 Oct 2012 13:46:02 +0000 (14:46 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=654259

gst/matroska/matroska-demux.c

index 10d3733..049f4b4 100644 (file)
@@ -3431,9 +3431,10 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
     goto data_error;
 
   if (ret == GST_FLOW_OK && readblock) {
+    gboolean invisible_frame = FALSE;
+    gboolean delta_unit = FALSE;
     guint64 duration = 0;
     gint64 lace_time = 0;
-    gboolean delta_unit;
 
     stream = g_ptr_array_index (demux->common.src, stream_num);
 
@@ -3503,8 +3504,13 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
     /* For SimpleBlock, look at the keyframe bit in flags. Otherwise,
        a ReferenceBlock implies that this is not a keyframe. In either
        case, it only makes sense for video streams. */
-    delta_unit = stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO &&
-        ((is_simpleblock && !(flags & 0x80)) || referenceblock);
+    if (stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO) {
+      if ((is_simpleblock && !(flags & 0x80)) || referenceblock) {
+        delta_unit = TRUE;
+        invisible_frame = ((flags & 0x08)) &&
+            (strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8) == 0);
+      }
+    }
 
     if (delta_unit && stream->set_discont) {
       /* When doing seeks or such, we need to restart on key frames or
@@ -3569,6 +3575,9 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
       else
         GST_BUFFER_FLAG_UNSET (sub, GST_BUFFER_FLAG_DELTA_UNIT);
 
+      if (invisible_frame)
+        GST_BUFFER_FLAG_SET (sub, GST_BUFFER_FLAG_DECODE_ONLY);
+
       if (stream->encodings != NULL && stream->encodings->len > 0)
         sub = gst_matroska_decode_buffer (stream, sub);