[FFmpeg-devel] [PATCH] avcodec/frame_thread_encoder: remove buffer_mutex

Michael Niedermayer michaelni at gmx.at
Tue Dec 23 01:44:03 CET 2014


It was used for protecting calls to get/release_buffer()
there are no such calls anymore

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/frame_thread_encoder.c |    7 -------
 1 file changed, 7 deletions(-)

diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c
index 9a49fea..e10845e 100644
--- a/libavcodec/frame_thread_encoder.c
+++ b/libavcodec/frame_thread_encoder.c
@@ -47,7 +47,6 @@ typedef struct{
 
 typedef struct{
     AVCodecContext *parent_avctx;
-    pthread_mutex_t buffer_mutex;
 
     AVFifoBuffer *task_fifo;
     pthread_mutex_t task_fifo_mutex;
@@ -91,9 +90,7 @@ static void * attribute_align_arg worker(void *v){
         frame = task.indata;
 
         ret = avcodec_encode_video2(avctx, pkt, frame, &got_packet);
-        pthread_mutex_lock(&c->buffer_mutex);
         av_frame_unref(frame);
-        pthread_mutex_unlock(&c->buffer_mutex);
         av_frame_free(&frame);
         if(got_packet) {
             av_dup_packet(pkt);
@@ -109,9 +106,7 @@ static void * attribute_align_arg worker(void *v){
     }
 end:
     av_free(pkt);
-    pthread_mutex_lock(&c->buffer_mutex);
     avcodec_close(avctx);
-    pthread_mutex_unlock(&c->buffer_mutex);
     av_freep(&avctx);
     return NULL;
 }
@@ -182,7 +177,6 @@ int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){
 
     pthread_mutex_init(&c->task_fifo_mutex, NULL);
     pthread_mutex_init(&c->finished_task_mutex, NULL);
-    pthread_mutex_init(&c->buffer_mutex, NULL);
     pthread_cond_init(&c->task_fifo_cond, NULL);
     pthread_cond_init(&c->finished_task_cond, NULL);
 
@@ -239,7 +233,6 @@ void ff_frame_thread_encoder_free(AVCodecContext *avctx){
 
     pthread_mutex_destroy(&c->task_fifo_mutex);
     pthread_mutex_destroy(&c->finished_task_mutex);
-    pthread_mutex_destroy(&c->buffer_mutex);
     pthread_cond_destroy(&c->task_fifo_cond);
     pthread_cond_destroy(&c->finished_task_cond);
     av_fifo_freep(&c->task_fifo);
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list