Re: [FFmpeg-devel] [PATCH 1/2] avformat/adp, svs: Remove redundant av_shrink_packet()

2021-03-12 Thread James Almer

On 3/12/2021 7:53 AM, Andreas Rheinhardt wrote:

av_get_packet() already makes sure that the packet size is accurate
and that the packet data is zero-padded even when one could not read as
much as desired.

Signed-off-by: Andreas Rheinhardt 
---
  libavformat/adp.c | 8 ++--
  libavformat/svs.c | 1 -
  2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/libavformat/adp.c b/libavformat/adp.c
index 8668c78fe4..b0ee09753e 100644
--- a/libavformat/adp.c
+++ b/libavformat/adp.c
@@ -75,13 +75,9 @@ static int adp_read_packet(AVFormatContext *s, AVPacket *pkt)
  return AVERROR_EOF;
  
  ret = av_get_packet(s->pb, pkt, size);

+if (ret < 0)
+return ret;
  
-if (ret != size) {

-if (ret < 0) {
-return ret;
-}
-av_shrink_packet(pkt, ret);
-}
  pkt->stream_index = 0;
  
  return ret;

diff --git a/libavformat/svs.c b/libavformat/svs.c
index d4285ed306..8be26c5bc3 100644
--- a/libavformat/svs.c
+++ b/libavformat/svs.c
@@ -79,7 +79,6 @@ static int svs_read_packet(AVFormatContext *s, AVPacket *pkt)
  if (ret != 32 * 256) {
  if (ret < 0)
  return ret;
-av_shrink_packet(pkt, ret);
  pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
  }
  pkt->stream_index = 0;


LGTM.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH 1/2] avformat/adp, svs: Remove redundant av_shrink_packet()

2021-03-12 Thread Andreas Rheinhardt
av_get_packet() already makes sure that the packet size is accurate
and that the packet data is zero-padded even when one could not read as
much as desired.

Signed-off-by: Andreas Rheinhardt 
---
 libavformat/adp.c | 8 ++--
 libavformat/svs.c | 1 -
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/libavformat/adp.c b/libavformat/adp.c
index 8668c78fe4..b0ee09753e 100644
--- a/libavformat/adp.c
+++ b/libavformat/adp.c
@@ -75,13 +75,9 @@ static int adp_read_packet(AVFormatContext *s, AVPacket *pkt)
 return AVERROR_EOF;
 
 ret = av_get_packet(s->pb, pkt, size);
+if (ret < 0)
+return ret;
 
-if (ret != size) {
-if (ret < 0) {
-return ret;
-}
-av_shrink_packet(pkt, ret);
-}
 pkt->stream_index = 0;
 
 return ret;
diff --git a/libavformat/svs.c b/libavformat/svs.c
index d4285ed306..8be26c5bc3 100644
--- a/libavformat/svs.c
+++ b/libavformat/svs.c
@@ -79,7 +79,6 @@ static int svs_read_packet(AVFormatContext *s, AVPacket *pkt)
 if (ret != 32 * 256) {
 if (ret < 0)
 return ret;
-av_shrink_packet(pkt, ret);
 pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
 }
 pkt->stream_index = 0;
-- 
2.27.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".