[FFmpeg-devel] [PATCH] fixed a bug for hls demuxer when seeking
Deng James
hugeice at gmail.com
Mon Dec 16 03:55:51 CET 2013
2013/12/14 Michael Niedermayer <michaelni at gmx.at>
> On Wed, Dec 11, 2013 at 06:18:58PM +0800, James Deng wrote:
> > when seeking, only check key frame for user-specified stream (passed
> > in as a parameter); otherwise the key frame checking logic will be
> > broken by audio packets (because usually all audio packets are key
> > frames), and give the decoder a non-key frame and cause it to crash
> > ---
> > libavformat/hls.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/libavformat/hls.c b/libavformat/hls.c
> > index 471a62d..c5dcf96 100644
> > --- a/libavformat/hls.c
> > +++ b/libavformat/hls.c
> > @@ -101,6 +101,7 @@ typedef struct HLSContext {
> > int first_packet;
> > int64_t first_timestamp;
> > int64_t seek_timestamp;
> > + int seek_stream_index;
> > int seek_flags;
> > AVIOInterruptCB *interrupt_callback;
> > char *user_agent; ///< holds HTTP user agent set
> as an AVOption to the HTTP protocol context
> > @@ -624,6 +625,7 @@ static int hls_read_header(AVFormatContext *s)
> > c->first_packet = 1;
> > c->first_timestamp = AV_NOPTS_VALUE;
> > c->seek_timestamp = AV_NOPTS_VALUE;
> > + c->seek_stream_index = -1;
> >
> > return 0;
> > fail:
> > @@ -702,6 +704,8 @@ start:
> >
> > if (c->seek_timestamp == AV_NOPTS_VALUE)
> > break;
> > + if ( c->seek_stream_index >= 0 && c->seek_stream_index
> != var->pkt.stream_index )
> > + continue;
> >
> > if (var->pkt.dts == AV_NOPTS_VALUE) {
> > c->seek_timestamp = AV_NOPTS_VALUE;
>
> i think this would leak memory
>
> [...]
> --
> 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
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
The last patch I sent does have memory leak, and I have fixed it in the
updated patch, which is in the attachment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fixed-a-bug-for-hls-demuxer-when-seeking.patch
Type: application/octet-stream
Size: 3643 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131216/00e2de5a/attachment.obj>
More information about the ffmpeg-devel
mailing list