mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
fftools/ffmpeg, doc/examples: Remove redundant av_packet_unref
av_interleaved_write_frame() already returns blank packets. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
259026b457
commit
8a23159797
@ -110,7 +110,9 @@ static int write_frame(AVFormatContext *fmt_ctx, AVCodecContext *c,
|
|||||||
/* Write the compressed frame to the media file. */
|
/* Write the compressed frame to the media file. */
|
||||||
log_packet(fmt_ctx, &pkt);
|
log_packet(fmt_ctx, &pkt);
|
||||||
ret = av_interleaved_write_frame(fmt_ctx, &pkt);
|
ret = av_interleaved_write_frame(fmt_ctx, &pkt);
|
||||||
av_packet_unref(&pkt);
|
/* pkt is now blank (av_interleaved_write_frame() takes ownership of
|
||||||
|
* its contents and resets pkt), so that no unreferencing is necessary.
|
||||||
|
* This would be different if one used av_write_frame(). */
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Error while writing output packet: %s\n", av_err2str(ret));
|
fprintf(stderr, "Error while writing output packet: %s\n", av_err2str(ret));
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -163,11 +163,13 @@ int main(int argc, char **argv)
|
|||||||
log_packet(ofmt_ctx, &pkt, "out");
|
log_packet(ofmt_ctx, &pkt, "out");
|
||||||
|
|
||||||
ret = av_interleaved_write_frame(ofmt_ctx, &pkt);
|
ret = av_interleaved_write_frame(ofmt_ctx, &pkt);
|
||||||
|
/* pkt is now blank (av_interleaved_write_frame() takes ownership of
|
||||||
|
* its contents and resets pkt), so that no unreferencing is necessary.
|
||||||
|
* This would be different if one used av_write_frame(). */
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Error muxing packet\n");
|
fprintf(stderr, "Error muxing packet\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
av_packet_unref(&pkt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
av_write_trailer(ofmt_ctx);
|
av_write_trailer(ofmt_ctx);
|
||||||
|
@ -871,7 +871,6 @@ static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int u
|
|||||||
main_return_code = 1;
|
main_return_code = 1;
|
||||||
close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED);
|
close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED);
|
||||||
}
|
}
|
||||||
av_packet_unref(pkt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void close_output_stream(OutputStream *ost)
|
static void close_output_stream(OutputStream *ost)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user