Fix incorrectly constructed Dirac parse units that caused A/V sync loss.
[ffmpeg.git] / libavcodec / libschroedingerdec.c
index f9b4d2198ad77e750dddc3ae860f0f17fd4ca880..36cba01d36a77fb81b9667cf4cfdc559c533d767 100644 (file)
@@ -235,6 +235,9 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
     do {
         if ((enc_buf = FfmpegFindNextSchroParseUnit(&parse_ctx))) {
             /* Push buffer into decoder. */
+            if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) &&
+                SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0)
+                avccontext->has_b_frames = 1;
             state = schro_decoder_push (decoder, enc_buf);
             if (state == SCHRO_DECODER_FIRST_ACCESS_UNIT)
                   libschroedinger_handle_first_access_unit(avccontext);