From 01c3814514f2098ed833381f02761a0b8dd846a0 Mon Sep 17 00:00:00 2001 From: qianlongxu Date: Tue, 5 Nov 2024 09:20:10 +0800 Subject: [PATCH] reset_buffer_size need lock --- ijkmedia/ijkplayer/ff_ffplay.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ijkmedia/ijkplayer/ff_ffplay.c b/ijkmedia/ijkplayer/ff_ffplay.c index aed757636..1e6484709 100755 --- a/ijkmedia/ijkplayer/ff_ffplay.c +++ b/ijkmedia/ijkplayer/ff_ffplay.c @@ -3330,6 +3330,7 @@ static void reset_buffer_size(FFPlayer *ffp) if (!ffp->is) { return; } + SDL_LockMutex(ffp->is->play_mutex); int buffer_size = DEFAULT_QUEUE_SIZE; double audio_delay = ffp->is->audio_st ? get_clock_extral_delay(&ffp->is->audclk) : 0; AVFormatContext *ic = ffp->is->ic; @@ -3349,6 +3350,7 @@ static void reset_buffer_size(FFPlayer *ffp) } ffp->dcc.max_buffer_size = buffer_size + fabs(audio_delay) * DEFAULT_QUEUE_SIZE; + SDL_UnlockMutex(ffp->is->play_mutex); av_log(NULL, AV_LOG_INFO, "auto decision max buffer size:%dMB\n",ffp->dcc.max_buffer_size/1024/1024); }