diff mbox

[FFmpeg-devel] ffmpeg: don't overwrite av_bsf_receive_packet return value before checking it

Message ID 20161104032116.4320-1-jamrial@gmail.com
State Accepted
Headers show

Commit Message

James Almer Nov. 4, 2016, 3:21 a.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 ffmpeg.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Nov. 4, 2016, 11:13 a.m. UTC | #1
On Fri, Nov 04, 2016 at 12:21:16AM -0300, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  ffmpeg.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

LGTM

thx

PS: not sure ret == AVERROR(EAGAIN) should maybe be done earlier

[...]
James Almer Nov. 5, 2016, 3:08 a.m. UTC | #2
On 11/4/2016 8:13 AM, Michael Niedermayer wrote:
> On Fri, Nov 04, 2016 at 12:21:16AM -0300, James Almer wrote:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  ffmpeg.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> LGTM
> 
> thx
> 
> PS: not sure ret == AVERROR(EAGAIN) should maybe be done earlier

Good idea. Applied that instead.

Thanks.
diff mbox

Patch

diff --git a/ffmpeg.c b/ffmpeg.c
index 9809876..8c672cd 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -805,9 +805,11 @@  static void output_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
              * TODO/FIXME - Make aac_adtstoasc use new packet side data instead of changing
              * par_out->extradata and adapt muxers accordingly to get rid of this. */
             if (!(ost->bsf_extradata_updated[idx - 1] & 1)) {
-                ret = avcodec_parameters_copy(ost->st->codecpar, ost->bsf_ctx[idx - 1]->par_out);
-                if (ret < 0)
+                int err = avcodec_parameters_copy(ost->st->codecpar, ost->bsf_ctx[idx - 1]->par_out);
+                if (err < 0) {
+                    ret = err;
                     goto finish;
+                }
                 ost->bsf_extradata_updated[idx - 1] |= 1;
             }
             if (ret == AVERROR(EAGAIN)) {