On Sat, 21 Jan 2012 14:09:07 +0200, Martin Storsjö <[email protected]> wrote:
> This avoids reading any old data in the AVIOContext buffer after
> the seek, and indicates to the mpegts demuxer that we've seeked,
> avoiding continuity check errors.
> ---
>  libavformat/applehttp.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c
> index 38023f6..3ee233f 100644
> --- a/libavformat/applehttp.c
> +++ b/libavformat/applehttp.c
> @@ -700,6 +700,10 @@ static int applehttp_read_seek(AVFormatContext *s, int 
> stream_index,
>          av_free_packet(&var->pkt);
>          reset_packet(&var->pkt);
>          var->pb.eof_reached = 0;
> +        /* Clear any buffered data */
> +        var->pb.buf_end = var->pb.buf_ptr = var->pb.buffer;
> +        /* Reset the pos, to let the mpegts demuxer know we've seeked. */
> +        var->pb.pos = 0;
>  
>          /* Locate the segment that contains the target timestamp */
>          for (j = 0; j < var->n_segments; j++) {
> -- 
> 1.7.3.1
> 

Manipulating AVIOContext internals like this from a demuxer makes me
uneasy.  Maybe this should be a separate avio function.

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

Reply via email to