From d45b66938dff94e252bf308d03a971bc1d66c01d Mon Sep 17 00:00:00 2001 From: sirius Date: Tue, 7 Jan 2020 11:32:56 +0800 Subject: [PATCH] make latter to wait when write_frame collision between audio and video --- src/engine/client/video.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/engine/client/video.cpp b/src/engine/client/video.cpp index 138388dc2..d8ea41299 100644 --- a/src/engine/client/video.cpp +++ b/src/engine/client/video.cpp @@ -202,8 +202,10 @@ void CVideo::stop() void CVideo::nextVideoFrame_thread() { - if (m_NextFrame && m_Recording && !m_ProcessingAudioFrame) + if (m_NextFrame && m_Recording) { + while(m_ProcessingAudioFrame) + continue; // #ifdef CONF_PLATFORM_MACOSX // CAutoreleasePool AutoreleasePool; // #endif @@ -262,8 +264,10 @@ void CVideo::nextAudioFrame_timeline() void CVideo::nextAudioFrame(void (*Mix)(short *pFinalOut, unsigned Frames)) { - if (m_NextaFrame && m_Recording && m_HasAudio && !m_ProcessingVideoFrame) + if (m_NextaFrame && m_Recording && m_HasAudio) { + while(m_ProcessingVideoFrame) + continue; m_ProcessingAudioFrame = true; //dbg_msg("video recorder", "video_frame: %lf", (double)(m_vframe/m_FPS)); //if((double)(m_vframe/m_FPS) < m_AudioStream.enc->frame_number*m_AudioStream.enc->frame_size/m_AudioStream.enc->sample_rate)