[FFmpeg-devel] [PATCH] avdevice/decklink: Remove pthread dependency

wm4 nfxjfg at googlemail.com
Thu Feb 23 07:45:03 EET 2017


On Wed, 22 Feb 2017 14:55:23 -0800
Kyle Schwarz <zeranoe at gmail.com> wrote:

> DeckLink depends on pthread, and is silently disabled if pthread is missing.
> 
> Also fixes w32pthreads to support C++.
> ---


>  
> -        sem_post(&ctx->semaphore);
> +        pthread_mutex_unlock(&ctx->mutex);
>  
>          return S_OK;

> @@ -248,7 +246,7 @@ static int decklink_write_video_packet(AVFormatContext *avctx, AVPacket *pkt)
>      }
>  
>      /* Always keep at most one second of frames buffered. */
> -    sem_wait(&ctx->semaphore);
> +    pthread_cond_wait(&ctx->cond, &ctx->mutex);
>  
>      /* Schedule frame for playback. */
>      hr = ctx->dlo->ScheduleVideoFrame((struct IDeckLinkVideoFrame *) frame,

That doesn't really look convincing. These operations do different
things. Moreover, calling pthread_mutex_unlock without a preceding
pthread_mutex_lock is invalid. Calling pthread_cond_wait without
locking the mutex is an error.


More information about the ffmpeg-devel mailing list