This commit is contained in:
veejay
2023-09-17 03:30:20 +02:00
parent d9a31aeaa6
commit 2d9792f103

View File

@@ -578,29 +578,6 @@ static int v4l2_setup_avcodec_capture( v4l2info *v, int wid, int hei, int codec_
#if LIBAVCODEC_BUILD > 5400
v->c = avcodec_alloc_context3( v->codec );
int n_threads = 0;
char *num_decode_threads = getenv( "VEEJAY_NUM_DECODE_THREADS" );
if( num_decode_threads ) {
n_threads = atoi(num_decode_threads);
}
else {
veejay_msg(VEEJAY_MSG_DEBUG, "env VEEJAY_NUM_DECODE_THREADS not set!");
int n = task_num_cpus();
if( n > 1 )
n_threads = 2;
if( n > 3 )
n_threads = 4;
}
veejay_msg(VEEJAY_MSG_DEBUG, "Using %d decoding threads (ffmpeg)", n_threads);
if( n_threads > 0 ) {
v->c->thread_count = n_threads;
v->c->thread_type = FF_THREAD_FRAME;
}
#else
v->c = avcodec_alloc_context();
#endif
@@ -624,7 +601,7 @@ static int v4l2_setup_avcodec_capture( v4l2info *v, int wid, int hei, int codec_
e->context->thread_count = n_threads;
e->context->thread_type = FF_THREAD_FRAME;
}
if( avcodec_open2( v->c, v->codec, NULL ) < 0 )
#else
if( avcodec_open( v->c, v->codec ) < 0 )