fftools/ffmpeg_demux: do not store demux packet in the context

Its use is local to input_thread().
This commit is contained in:
Anton Khirnov 2022-03-22 17:59:30 +01:00
parent de9fb9fba7
commit 61d9f34c70
4 changed files with 10 additions and 7 deletions

View File

@ -593,7 +593,6 @@ static void ffmpeg_cleanup(int ret)
free_input_threads();
for (i = 0; i < nb_input_files; i++) {
avformat_close_input(&input_files[i]->ctx);
av_packet_free(&input_files[i]->pkt);
av_freep(&input_files[i]);
}
for (i = 0; i < nb_input_streams; i++) {

View File

@ -437,8 +437,6 @@ typedef struct InputFile {
float readrate;
int accurate_seek;
AVPacket *pkt;
AVThreadMessageQueue *in_thread_queue;
pthread_t thread; /* thread reading from this file */
int non_blocking; /* reading packets from the thread should not block */

View File

@ -117,10 +117,16 @@ static int seek_to_start(InputFile *ifile)
static void *input_thread(void *arg)
{
InputFile *f = arg;
AVPacket *pkt = f->pkt;
AVPacket *pkt;
unsigned flags = f->non_blocking ? AV_THREAD_MESSAGE_NONBLOCK : 0;
int ret = 0;
pkt = av_packet_alloc();
if (!pkt) {
ret = AVERROR(ENOMEM);
goto finish;
}
while (1) {
DemuxMsg msg = { NULL };
@ -185,9 +191,12 @@ static void *input_thread(void *arg)
}
}
finish:
av_assert0(ret < 0);
av_thread_message_queue_set_err_recv(f->in_thread_queue, ret);
av_packet_free(&pkt);
return NULL;
}

View File

@ -1407,9 +1407,6 @@ static int open_input_file(OptionsContext *o, const char *filename)
f->rate_emu = 0;
}
f->pkt = av_packet_alloc();
if (!f->pkt)
exit_program(1);
f->thread_queue_size = o->thread_queue_size;
/* check if all codec options have been used */