[FFmpeg-devel] Problem with initial dts in h264

Michael Niedermayer michaelni
Mon Dec 7 04:15:53 CET 2009

On Sun, Dec 06, 2009 at 03:26:30PM -0800, John Stebbins wrote:
> A recent change has caused the initial dts in h264 streams returned by
> av_read_frame to be incorrect.  The commit was r20599.  The root cause
> of the problem comes from moving the assignment of s->avctx->pix_fmt
> from h264.c:decode_init() to decode_slice_header().  This movement has the
> side effect of making has_codec_parameters() in libavformat/utils.c fail
> during av_find_stream_info(). This causes try_decode_frame() to be called
> which ultimately sets st->codec->has_b_frames = 2.  This the causes
> compute_pkt_fields() in libavformat/utils.c to start buffering up multiple
> pts values in st->pts_buffer.  All this happens during the initial call
> to av_find_stream_info.  Then later, when the application calls
> av_read_frame, the pts values that were buffered during the previous
> av_find_stream_info are used to set the dts value of the returned packet.

> This is especially obnoxious when the reader does a seek before 
> av_read_frame.

send a patch that resets pts_buffer in av_read_frame_flush()
(assuming its tested & works of course)

There may be further bugfixes needed but this one seems obviously missing

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091207/d0fd377b/attachment.pgp>

More information about the ffmpeg-devel mailing list