Commit d393f41a authored by Reimar Döffinger's avatar Reimar Döffinger

Fix memleak after switch to encode_audio2 API.

Obviously the packet allocated by the encoder must be freed somewhere.
Signed-off-by: 's avatarReimar Döffinger <Reimar.Doeffinger@gmx.de>
parent 178f8ea7
...@@ -1065,6 +1065,8 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost, ...@@ -1065,6 +1065,8 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost,
exit_program(1); exit_program(1);
} }
ret = pkt.size;
if (got_packet) { if (got_packet) {
pkt.stream_index = ost->index; pkt.stream_index = ost->index;
if (pkt.pts != AV_NOPTS_VALUE) if (pkt.pts != AV_NOPTS_VALUE)
...@@ -1075,12 +1077,14 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost, ...@@ -1075,12 +1077,14 @@ static int encode_audio_frame(AVFormatContext *s, OutputStream *ost,
write_frame(s, &pkt, ost); write_frame(s, &pkt, ost);
audio_size += pkt.size; audio_size += pkt.size;
av_free_packet(&pkt);
} }
if (frame) if (frame)
ost->sync_opts += frame->nb_samples; ost->sync_opts += frame->nb_samples;
return pkt.size; return ret;
} }
static void do_audio_out(AVFormatContext *s, OutputStream *ost, static void do_audio_out(AVFormatContext *s, OutputStream *ost,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment