Skip to content

Commit

Permalink
Drop av_lockmgr setup
Browse files Browse the repository at this point in the history
This API was obsoleted and doesn't exist anymore:

2017-12-26 - a04c2c707d - lavc 58.9.100 - avcodec.h
  Deprecate av_lockmgr_register(). You need to build FFmpeg with threading
  support enabled to get basic thread-safety (which is the default build
  configuration).
  • Loading branch information
andrey-utkin committed Jun 7, 2024
1 parent b1861e9 commit 6a68e0e
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 deletions server/ffmpeg-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,38 +50,8 @@ static void av_log_cb(void *avcl, int level, const char *fmt, va_list ap)
bc_vlog(bc_level, msg, ap);
}

static int bc_av_lockmgr(void **mutex_p, enum AVLockOp op)
{
pthread_mutex_t **mutex = (pthread_mutex_t**)mutex_p;
switch (op) {
case AV_LOCK_CREATE:
*mutex = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t));
if (!*mutex)
return 1;
return !!pthread_mutex_init(*mutex, NULL);

case AV_LOCK_OBTAIN:
return !!pthread_mutex_lock(*mutex);

case AV_LOCK_RELEASE:
return !!pthread_mutex_unlock(*mutex);

case AV_LOCK_DESTROY:
pthread_mutex_destroy(*mutex);
free(*mutex);
return 0;
}

return 1;
}

void bc_ffmpeg_init()
{
if (av_lockmgr_register(bc_av_lockmgr)) {
bc_log(Fatal, "libav lock registration failed");
exit(1);
}

avformat_network_init();
avdevice_register_all();

Expand All @@ -90,5 +60,5 @@ void bc_ffmpeg_init()

void bc_ffmpeg_teardown()
{
av_lockmgr_register(NULL); // deprecated
;
}

0 comments on commit 6a68e0e

Please sign in to comment.