make latter to wait when write_frame collision between audio and video

This commit is contained in:
sirius 2020-01-07 11:32:56 +08:00
parent 3baba93ed2
commit d45b66938d

View file

@ -202,8 +202,10 @@ void CVideo::stop()
void CVideo::nextVideoFrame_thread() void CVideo::nextVideoFrame_thread()
{ {
if (m_NextFrame && m_Recording && !m_ProcessingAudioFrame) if (m_NextFrame && m_Recording)
{ {
while(m_ProcessingAudioFrame)
continue;
// #ifdef CONF_PLATFORM_MACOSX // #ifdef CONF_PLATFORM_MACOSX
// CAutoreleasePool AutoreleasePool; // CAutoreleasePool AutoreleasePool;
// #endif // #endif
@ -262,8 +264,10 @@ void CVideo::nextAudioFrame_timeline()
void CVideo::nextAudioFrame(void (*Mix)(short *pFinalOut, unsigned Frames)) 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; m_ProcessingAudioFrame = true;
//dbg_msg("video recorder", "video_frame: %lf", (double)(m_vframe/m_FPS)); //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) //if((double)(m_vframe/m_FPS) < m_AudioStream.enc->frame_number*m_AudioStream.enc->frame_size/m_AudioStream.enc->sample_rate)