theoradec: Make the keyframe condition check clearer
authorJan Schmidt <jan@centricular.com>
Fri, 3 Mar 2017 13:12:26 +0000 (00:12 +1100)
committerJan Schmidt <jan@centricular.com>
Fri, 3 Mar 2017 13:30:37 +0000 (00:30 +1100)
Make the keyframe checking if statement easier to
read, and add some debug when detecting a keyframe

ext/theora/gsttheoradec.c

index 45c777e..859b867 100644 (file)
@@ -277,9 +277,11 @@ theora_dec_parse (GstVideoDecoder * decoder,
 
   if (av > 0) {
     data = gst_adapter_map (adapter, 1);
-    /* check for keyframe; must not be header packet */
-    if (!(data[0] & 0x80) && (data[0] & 0x40) == 0)
+    /* check for keyframe; must not be header packet (0x80 | 0x40) */
+    if (!(data[0] & 0xc0)) {
       GST_VIDEO_CODEC_FRAME_SET_SYNC_POINT (frame);
+      GST_LOG_OBJECT (decoder, "Found keyframe");
+    }
     gst_adapter_unmap (adapter);
   }