std::thread* m_thread_process = nullptr;
std::mutex m_mutex_process;
std::atomic<bool> m_thread_run {true};
std::condition_variable m_cond1, m_cond2;
std::atomic<int> m_process_num;
bytertc::IVideoFrame* m_currentFrame = nullptr;
m_thread_process = new std::thread(funcProcessVideoFrame, this); //启动新线程
m_video = bytertc::createRTCVideo(g_appid.c_str(), m_handler.get(), nullptr);
m_video->startAudioCapture();
m_video->startVideoCapture();
m_video->registerLocalVideoProcessor(this); //注册回调接口
m_room = m_video->createRTCRoom(roomid);
bytertc::IVideoFrame *processVideoFrame(bytertc::IVideoFrame * videoFrame)
if (!videoFrame) return nullptr;
std::unique_lock<std::mutex> lock(m_mutex_process);
m_currentFrame = videoFrame;
m_cond2.wait(lock, [this]() {return m_thread_run == false || m_process_num == 0; });
void funcProcessVideoFrame()
if (m_thread_run == false) {
std::unique_lock<std::mutex> l(m_mutex_process);
m_cond1.wait(l, [this]() {return m_thread_run == false || m_process_num > 0; });
dealVideoFrame();//处理视频帧,美颜
void dealVideoFrame(){ // 处理视频帧的具体实现