forked from FFmpeg/FFmpeg
libavdevice/avfoundation.m: fix protential unreleased lock issue
The problem here is that the lock ctx->frame_lock will become an unreleased lock if the program returns at line 697, line 735 and line744. Bug tracker link: https://trac.ffmpeg.org/ticket/9385\#ticket Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
This commit is contained in:
parent
a6760bb92b
commit
9bbdfbfb32
1 changed files with 3 additions and 0 deletions
|
@ -693,6 +693,7 @@ static int get_audio_config(AVFormatContext *s)
|
||||||
const AudioStreamBasicDescription *basic_desc = CMAudioFormatDescriptionGetStreamBasicDescription(format_desc);
|
const AudioStreamBasicDescription *basic_desc = CMAudioFormatDescriptionGetStreamBasicDescription(format_desc);
|
||||||
|
|
||||||
if (!basic_desc) {
|
if (!basic_desc) {
|
||||||
|
unlock_frames(ctx);
|
||||||
av_log(s, AV_LOG_ERROR, "audio format not available\n");
|
av_log(s, AV_LOG_ERROR, "audio format not available\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -731,6 +732,7 @@ static int get_audio_config(AVFormatContext *s)
|
||||||
ctx->audio_packed) {
|
ctx->audio_packed) {
|
||||||
stream->codecpar->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S32BE : AV_CODEC_ID_PCM_S32LE;
|
stream->codecpar->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S32BE : AV_CODEC_ID_PCM_S32LE;
|
||||||
} else {
|
} else {
|
||||||
|
unlock_frames(ctx);
|
||||||
av_log(s, AV_LOG_ERROR, "audio format is not supported\n");
|
av_log(s, AV_LOG_ERROR, "audio format is not supported\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -740,6 +742,7 @@ static int get_audio_config(AVFormatContext *s)
|
||||||
ctx->audio_buffer_size = CMBlockBufferGetDataLength(block_buffer);
|
ctx->audio_buffer_size = CMBlockBufferGetDataLength(block_buffer);
|
||||||
ctx->audio_buffer = av_malloc(ctx->audio_buffer_size);
|
ctx->audio_buffer = av_malloc(ctx->audio_buffer_size);
|
||||||
if (!ctx->audio_buffer) {
|
if (!ctx->audio_buffer) {
|
||||||
|
unlock_frames(ctx);
|
||||||
av_log(s, AV_LOG_ERROR, "error allocating audio buffer\n");
|
av_log(s, AV_LOG_ERROR, "error allocating audio buffer\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue