[FFmpeg-cvslog] avcodec/mlpenc: stop returning packets with no data
Paul B Mahol
git at videolan.org
Sun Sep 5 12:45:50 EEST 2021
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Sep 5 11:36:50 2021 +0200| [036d94da43d09d3e9c312b7c3f6707212de804df] | committer: Paul B Mahol
avcodec/mlpenc: stop returning packets with no data
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=036d94da43d09d3e9c312b7c3f6707212de804df
---
libavcodec/mlpenc.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c
index 50662de09c..7db28f518a 100644
--- a/libavcodec/mlpenc.c
+++ b/libavcodec/mlpenc.c
@@ -1178,8 +1178,8 @@ static void write_frame_headers(MLPEncodeContext *ctx, uint8_t *frame_header,
}
/** Writes an entire access unit to the bitstream. */
-static unsigned int write_access_unit(MLPEncodeContext *ctx, uint8_t *buf,
- int buf_size, int restart_frame)
+static int write_access_unit(MLPEncodeContext *ctx, uint8_t *buf,
+ int buf_size, int restart_frame)
{
uint16_t substream_data_len[MAX_SUBSTREAMS];
uint8_t *buf1, *buf0 = buf;
@@ -2183,7 +2183,7 @@ static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet)
{
MLPEncodeContext *ctx = avctx->priv_data;
- unsigned int bytes_written = 0;
+ int bytes_written = 0;
int restart_frame, ret;
uint8_t *data;
@@ -2316,8 +2316,14 @@ no_data_left:
}
if (!frame)
avctx->frame_number++;
- avpkt->size = bytes_written;
- *got_packet = 1;
+
+ if (bytes_written > 0) {
+ avpkt->size = bytes_written;
+ *got_packet = 1;
+ } else {
+ *got_packet = 0;
+ }
+
return 0;
}
More information about the ffmpeg-cvslog
mailing list