Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-10-13 15:51:16 +0300
committerAnton Khirnov <anton@khirnov.net>2022-10-18 14:57:43 +0300
commita55ca682e2c74a48bae0c1b76418a8fe0ac97733 (patch)
tree84b0f6dcab7c3ab6b7779f1db1bb27f8e3af226f /fftools
parent65d106933a5eea6cd0cb65446266a47cc83215d2 (diff)
fftools/ffmpeg_mux: allocate sq_pkt in setup_sync_queues()
This is now possible since setup_sync_queues() can interact with Muxer.
Diffstat (limited to 'fftools')
-rw-r--r--fftools/ffmpeg_mux.c8
-rw-r--r--fftools/ffmpeg_mux_init.c13
2 files changed, 10 insertions, 11 deletions
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 4cb5a71659..4c56f4ba96 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -671,14 +671,6 @@ int of_muxer_init(OutputFile *of, AVFormatContext *fc,
if (strcmp(of->format->name, "rtp"))
want_sdp = 0;
- if (of->sq_mux) {
- mux->sq_pkt = av_packet_alloc();
- if (!mux->sq_pkt) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- }
-
/* write the header for files with no streams */
if (of->format->flags & AVFMT_NOSTREAMS && fc->nb_streams == 0) {
ret = mux_check_init(of);
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 5b515ed034..6c4d9bad1e 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1040,8 +1040,9 @@ loop_end:
}
}
-static int setup_sync_queues(OutputFile *of, AVFormatContext *oc, int64_t buf_size_us)
+static int setup_sync_queues(Muxer *mux, AVFormatContext *oc, int64_t buf_size_us)
{
+ OutputFile *of = &mux->of;
int nb_av_enc = 0, nb_interleaved = 0;
int limit_frames = 0, limit_frames_av_enc = 0;
@@ -1103,6 +1104,10 @@ static int setup_sync_queues(OutputFile *of, AVFormatContext *oc, int64_t buf_si
if (!of->sq_mux)
return AVERROR(ENOMEM);
+ mux->sq_pkt = av_packet_alloc();
+ if (!mux->sq_pkt)
+ return AVERROR(ENOMEM);
+
for (int i = 0; i < oc->nb_streams; i++) {
OutputStream *ost = output_streams[of->ost_index + i];
enum AVMediaType type = ost->st->codecpar->codec_type;
@@ -1573,6 +1578,7 @@ static int set_dispositions(OutputFile *of, AVFormatContext *ctx)
int of_open(OptionsContext *o, const char *filename)
{
+ Muxer *mux;
AVFormatContext *oc;
int i, j, err;
OutputFile *of;
@@ -1594,7 +1600,8 @@ int of_open(OptionsContext *o, const char *filename)
}
}
- of = allocate_array_elem(&output_files, sizeof(Muxer), &nb_output_files);
+ mux = allocate_array_elem(&output_files, sizeof(Muxer), &nb_output_files);
+ of = &mux->of;
of->index = nb_output_files - 1;
of->ost_index = nb_output_streams;
@@ -1869,7 +1876,7 @@ int of_open(OptionsContext *o, const char *filename)
exit_program(1);
}
- err = setup_sync_queues(of, oc, o->shortest_buf_duration * AV_TIME_BASE);
+ err = setup_sync_queues(mux, oc, o->shortest_buf_duration * AV_TIME_BASE);
if (err < 0) {
av_log(NULL, AV_LOG_FATAL, "Error setting up output sync queues\n");
exit_program(1);