[FFmpeg-devel] [PATCH] fixed a bug for hls demuxer when seeking

Michael Niedermayer michaelni at gmx.at
Fri Dec 13 17:13:04 CET 2013


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131213/4c7e3420/attachment.asc>


More information about the ffmpeg-devel mailing list