update:VideoBuffer stop重命名为interrupt

This commit is contained in:
Barry 2019-06-15 18:29:19 +08:00
commit 667b09259c
3 changed files with 6 additions and 6 deletions

View file

@ -235,7 +235,7 @@ void Decoder::stopDecode()
{ {
m_quit = true; m_quit = true;
if (m_vb) { if (m_vb) {
m_vb->stop(); m_vb->interrupt();
} }
wait(); wait();
} }

View file

@ -74,7 +74,7 @@ bool VideoBuffer::offerDecodedFrame()
#ifndef SKIP_FRAMES #ifndef SKIP_FRAMES
// if SKIP_FRAMES is disabled, then the decoder must wait for the current // if SKIP_FRAMES is disabled, then the decoder must wait for the current
// frame to be consumed // frame to be consumed
while (!m_renderingFrameConsumed && !m_stopped) { while (!m_renderingFrameConsumed && !m_interrupted) {
m_renderingFrameConsumedCond.wait(&m_mutex); m_renderingFrameConsumedCond.wait(&m_mutex);
} }
#else #else
@ -105,11 +105,11 @@ const AVFrame *VideoBuffer::consumeRenderedFrame()
return m_renderingframe; return m_renderingframe;
} }
void VideoBuffer::stop() void VideoBuffer::interrupt()
{ {
#ifndef SKIP_FRAMES #ifndef SKIP_FRAMES
m_mutex.lock(); m_mutex.lock();
m_stopped = true; m_interrupted = true;
m_mutex.unlock(); m_mutex.unlock();
// wake up blocking wait // wake up blocking wait
m_renderingFrameConsumedCond.wakeOne(); m_renderingFrameConsumedCond.wakeOne();

View file

@ -33,7 +33,7 @@ public:
const AVFrame* consumeRenderedFrame(); const AVFrame* consumeRenderedFrame();
// wake up and avoid any blocking call // wake up and avoid any blocking call
void stop(); void interrupt();
private: private:
void swap(); void swap();
@ -47,7 +47,7 @@ private:
#ifndef SKIP_FRAMES #ifndef SKIP_FRAMES
QWaitCondition m_renderingFrameConsumedCond; QWaitCondition m_renderingFrameConsumedCond;
bool m_stopped = true; bool m_interrupted = true;
#endif #endif
}; };