[FFmpeg-devel] avformat/hls: Use av_packet_move_ref() for packet ownership transfer

Submitted by Andreas Rheinhardt on Dec. 1, 2019, 5:21 a.m.

Details

Message ID 20191201052157.10316-1-andreas.rheinhardt@gmail.com
State New
Headers show

Commit Message

Andreas Rheinhardt Dec. 1, 2019, 5:21 a.m.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/hls.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Steven Liu Dec. 2, 2019, 9:28 a.m.
> 在 2019年12月1日,13:21,Andreas Rheinhardt <andreas.rheinhardt@gmail.com> 写道:
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
> libavformat/hls.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 21353bbad7..f60396f246 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -2201,9 +2201,8 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
>         ist = pls->ctx->streams[pls->pkt.stream_index];
>         st = pls->main_streams[pls->pkt.stream_index];
> 
> -        *pkt = pls->pkt;
> +        av_packet_move_ref(pkt, &pls->pkt);
>         pkt->stream_index = st->index;
> -        reset_packet(&c->playlists[minplaylist]->pkt);
> 
>         if (pkt->dts != AV_NOPTS_VALUE)
>             c->cur_timestamp = av_rescale_q(pkt->dts,
> -- 
> 2.20.1
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe”.

LGTM

Thanks
Steven

Patch hide | download patch | download mbox

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 21353bbad7..f60396f246 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2201,9 +2201,8 @@  static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
         ist = pls->ctx->streams[pls->pkt.stream_index];
         st = pls->main_streams[pls->pkt.stream_index];
 
-        *pkt = pls->pkt;
+        av_packet_move_ref(pkt, &pls->pkt);
         pkt->stream_index = st->index;
-        reset_packet(&c->playlists[minplaylist]->pkt);
 
         if (pkt->dts != AV_NOPTS_VALUE)
             c->cur_timestamp = av_rescale_q(pkt->dts,