Originally, the avcodec_open2() at the start of avformat_find_stream_info
didn't work, since there was no extradata. Therefore, has_b_frames
was 0 and delay was 0 in compute_pkt_fields, and
update_initial_timestamps was called.

If the mov demuxer sets the extradata, the early avcodec_open2()
succeeds, setting has_b_frames == 1, making compute_pkt_fields
not call update_initial_timestamps at all (since delay was 1,
due to has_b_frames).
---
 libavformat/utils.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4145097..436470f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -976,7 +976,8 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream 
*st,
             FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i+1]);
         if(pkt->dts == AV_NOPTS_VALUE)
             pkt->dts= st->pts_buffer[0];
-        if(st->codec->codec_id == CODEC_ID_H264){ // we skipped it above so we 
try here
+        if (st->codec->codec_id == CODEC_ID_H264 ||
+            (st->codec->codec_id == CODEC_ID_VC1 && delay)) { // we skipped it 
above so we try here
             update_initial_timestamps(s, pkt->stream_index, pkt->dts, 
pkt->pts); // this should happen on the first packet
         }
         if(pkt->dts > st->cur_dts)
-- 
1.7.3.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to