diff mbox

[FFmpeg-devel,V1,1/3] lavf/hls: remove redundancy reset_packet() after av_packet_unref()

Message ID 1563719497-3780-1-git-send-email-mypopydev@gmail.com
State Accepted
Commit 606be4cb503a936a5fc5ecdaa0674164a611f701
Headers show

Commit Message

Jun Zhao July 21, 2019, 2:31 p.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

av_packet_unref have reseted the AVPacket, so don't need to call
reset_packet after that.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavformat/hls.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

Comments

Steven Liu July 25, 2019, 6 a.m. UTC | #1
Jun Zhao <mypopydev@gmail.com> 于2019年7月21日周日 下午10:55写道:
>
> From: Jun Zhao <barryjzhao@tencent.com>
>
> av_packet_unref have reseted the AVPacket, so don't need to call
> reset_packet after that.
>
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
>  libavformat/hls.c |    4 ----
>  1 files changed, 0 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 8c12fce..238ebd0 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -2120,7 +2120,6 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
>                      }
>                  }
>                  av_packet_unref(&pls->pkt);
> -                reset_packet(&pls->pkt);
>              }
>          }
>          /* Check if this stream has the packet with the lowest dts */
> @@ -2149,7 +2148,6 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
>          ret = update_streams_from_subdemuxer(s, pls);
>          if (ret < 0) {
>              av_packet_unref(&pls->pkt);
> -            reset_packet(&pls->pkt);
>              return ret;
>          }
>
> @@ -2174,7 +2172,6 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
>              av_log(s, AV_LOG_ERROR, "stream index inconsistency: index %d, %d main streams, %d subdemuxer streams\n",
>                     pls->pkt.stream_index, pls->n_main_streams, pls->ctx->nb_streams);
>              av_packet_unref(&pls->pkt);
> -            reset_packet(&pls->pkt);
>              return AVERROR_BUG;
>          }
>
> @@ -2262,7 +2259,6 @@ static int hls_read_seek(AVFormatContext *s, int stream_index,
>              ff_format_io_close(pls->parent, &pls->input_next);
>          pls->input_next_requested = 0;
>          av_packet_unref(&pls->pkt);
> -        reset_packet(&pls->pkt);
>          pls->pb.eof_reached = 0;
>          /* Clear any buffered data */
>          pls->pb.buf_end = pls->pb.buf_ptr = pls->pb.buffer;
> --
> 1.7.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
mypopy@gmail.com July 26, 2019, 1:34 a.m. UTC | #2
On Thu, Jul 25, 2019 at 2:00 PM Steven Liu <lingjiujianke@gmail.com> wrote:
>
> Jun Zhao <mypopydev@gmail.com> 于2019年7月21日周日 下午10:55写道:
> >
> > From: Jun Zhao <barryjzhao@tencent.com>
> >
> > av_packet_unref have reseted the AVPacket, so don't need to call
> > reset_packet after that.
> >
> > Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> > ---
> >  libavformat/hls.c |    4 ----
> >  1 files changed, 0 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavformat/hls.c b/libavformat/hls.c
> > index 8c12fce..238ebd0 100644
> > --- a/libavformat/hls.c
> > +++ b/libavformat/hls.c
> > @@ -2120,7 +2120,6 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
> >                      }
> >                  }
> >                  av_packet_unref(&pls->pkt);
> > -                reset_packet(&pls->pkt);
> >              }
> >          }
> >          /* Check if this stream has the packet with the lowest dts */
> > @@ -2149,7 +2148,6 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
> >          ret = update_streams_from_subdemuxer(s, pls);
> >          if (ret < 0) {
> >              av_packet_unref(&pls->pkt);
> > -            reset_packet(&pls->pkt);
> >              return ret;
> >          }
> >
> > @@ -2174,7 +2172,6 @@ static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
> >              av_log(s, AV_LOG_ERROR, "stream index inconsistency: index %d, %d main streams, %d subdemuxer streams\n",
> >                     pls->pkt.stream_index, pls->n_main_streams, pls->ctx->nb_streams);
> >              av_packet_unref(&pls->pkt);
> > -            reset_packet(&pls->pkt);
> >              return AVERROR_BUG;
> >          }
> >
> > @@ -2262,7 +2259,6 @@ static int hls_read_seek(AVFormatContext *s, int stream_index,
> >              ff_format_io_close(pls->parent, &pls->input_next);
> >          pls->input_next_requested = 0;
> >          av_packet_unref(&pls->pkt);
> > -        reset_packet(&pls->pkt);
> >          pls->pb.eof_reached = 0;
> >          /* Clear any buffered data */
> >          pls->pb.buf_end = pls->pb.buf_ptr = pls->pb.buffer;
> > --
> > 1.7.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
Will apply, Thanks
diff mbox

Patch

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 8c12fce..238ebd0 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2120,7 +2120,6 @@  static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
                     }
                 }
                 av_packet_unref(&pls->pkt);
-                reset_packet(&pls->pkt);
             }
         }
         /* Check if this stream has the packet with the lowest dts */
@@ -2149,7 +2148,6 @@  static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
         ret = update_streams_from_subdemuxer(s, pls);
         if (ret < 0) {
             av_packet_unref(&pls->pkt);
-            reset_packet(&pls->pkt);
             return ret;
         }
 
@@ -2174,7 +2172,6 @@  static int hls_read_packet(AVFormatContext *s, AVPacket *pkt)
             av_log(s, AV_LOG_ERROR, "stream index inconsistency: index %d, %d main streams, %d subdemuxer streams\n",
                    pls->pkt.stream_index, pls->n_main_streams, pls->ctx->nb_streams);
             av_packet_unref(&pls->pkt);
-            reset_packet(&pls->pkt);
             return AVERROR_BUG;
         }
 
@@ -2262,7 +2259,6 @@  static int hls_read_seek(AVFormatContext *s, int stream_index,
             ff_format_io_close(pls->parent, &pls->input_next);
         pls->input_next_requested = 0;
         av_packet_unref(&pls->pkt);
-        reset_packet(&pls->pkt);
         pls->pb.eof_reached = 0;
         /* Clear any buffered data */
         pls->pb.buf_end = pls->pb.buf_ptr = pls->pb.buffer;