|
@@ -27,39 +27,46 @@ void VideoPlayThread::run()
|
|
|
//qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] run start, m_pState:" << (void*)m_pState;
|
|
//qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] run start, m_pState:" << (void*)m_pState;
|
|
|
assert(m_pState);
|
|
assert(m_pState);
|
|
|
VideoState* is = m_pState;
|
|
VideoState* is = m_pState;
|
|
|
- // qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] VideoState* is:" << (void*)is << ", abort_request:" << is->abort_request;
|
|
|
|
|
|
|
+ qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] VideoState* is:" << (void*) is
|
|
|
|
|
+ << ", abort_request:" << is->abort_request;
|
|
|
double remaining_time = 0.0;
|
|
double remaining_time = 0.0;
|
|
|
int loop_count = 0;
|
|
int loop_count = 0;
|
|
|
for (;;) {
|
|
for (;;) {
|
|
|
if (isExit()) {
|
|
if (isExit()) {
|
|
|
- // qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] m_exit set, exit.";
|
|
|
|
|
|
|
+ qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] m_exit set, exit.";
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
if (is->abort_request) {
|
|
if (is->abort_request) {
|
|
|
- // qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] abort_request set, exit.";
|
|
|
|
|
|
|
+ qCDebug(playerControllerVideoPlayThread)
|
|
|
|
|
+ << "[VideoPlayThread] abort_request set, exit.";
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
if (is->eof && frame_queue_nb_remaining(&is->pictq) == 0) {
|
|
if (is->eof && frame_queue_nb_remaining(&is->pictq) == 0) {
|
|
|
- // qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] eof且队列空,退出线程";
|
|
|
|
|
|
|
+ qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] eof且队列空,退出线程";
|
|
|
break; // 线程退出
|
|
break; // 线程退出
|
|
|
}
|
|
}
|
|
|
if (is->paused) {
|
|
if (is->paused) {
|
|
|
- // qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] paused, wait.";
|
|
|
|
|
|
|
+ qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] paused, wait.";
|
|
|
std::unique_lock<std::mutex> lock(m_mutex);
|
|
std::unique_lock<std::mutex> lock(m_mutex);
|
|
|
m_cv.wait_for(lock, std::chrono::milliseconds(10), [this] { return isExit(); });
|
|
m_cv.wait_for(lock, std::chrono::milliseconds(10), [this] { return isExit(); });
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
- // qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] call video_refresh, loop:" << loop_count << ", pictq size:" << (is ? is->pictq.size : -1) << ", remaining_time:" << remaining_time;
|
|
|
|
|
|
|
+ qCDebug(playerControllerVideoPlayThread)
|
|
|
|
|
+ << "[VideoPlayThread] call video_refresh, loop:" << loop_count
|
|
|
|
|
+ << ", pictq size:" << (is ? is->pictq.size : -1)
|
|
|
|
|
+ << ", remaining_time:" << remaining_time;
|
|
|
if (remaining_time > 0.0)
|
|
if (remaining_time > 0.0)
|
|
|
av_usleep((int64_t) (remaining_time * 1000000.0));
|
|
av_usleep((int64_t) (remaining_time * 1000000.0));
|
|
|
remaining_time = REFRESH_RATE;
|
|
remaining_time = REFRESH_RATE;
|
|
|
if ((!is->paused || is->force_refresh)) {
|
|
if ((!is->paused || is->force_refresh)) {
|
|
|
- // qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] call video_refresh, loop:" << loop_count++;
|
|
|
|
|
|
|
+ qCDebug(playerControllerVideoPlayThread)
|
|
|
|
|
+ << "[VideoPlayThread] call video_refresh, loop:" << loop_count++;
|
|
|
video_refresh(is, &remaining_time);
|
|
video_refresh(is, &remaining_time);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- //qCDebug(playerControllerVideoPlayThread) << "[VideoPlayThread] run end, abort_request:" << is->abort_request
|
|
|
|
|
- // << ", m_exit:" << (m_exit ? m_exit->load() : -1);
|
|
|
|
|
|
|
+ qCDebug(playerControllerVideoPlayThread)
|
|
|
|
|
+ << "[VideoPlayThread] run end, abort_request:" << is->abort_request
|
|
|
|
|
+ << ", m_exit:" << (m_exit ? m_exit->load() : -1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void VideoPlayThread::video_refresh(VideoState* is, double* remaining_time)
|
|
void VideoPlayThread::video_refresh(VideoState* is, double* remaining_time)
|