From c80b0ffed151b5a42de4b042df2da0ee217c2341 Mon Sep 17 00:00:00 2001 From: wang-bin Date: Fri, 7 Jun 2013 22:14:34 +0800 Subject: [PATCH] work if audio output is null --- src/AVPlayer.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/AVPlayer.cpp b/src/AVPlayer.cpp index 45eb8b4f..0ff51554 100644 --- a/src/AVPlayer.cpp +++ b/src/AVPlayer.cpp @@ -287,15 +287,6 @@ void AVPlayer::pause(bool p) video_thread->pause(p); clock->pause(p); emit paused(p); -#if 0 - /*Pause output. all threads using those outputs will be paused. If a output is not paused - *, then other players' avthread can use it. - */ - if (_audio) - _audio->pause(p); - if (_renderer) - _renderer->pause(p); -#endif } bool AVPlayer::isPaused() const @@ -303,14 +294,6 @@ bool AVPlayer::isPaused() const return (demuxer_thread && demuxer_thread->isPaused()) || (audio_thread && audio_thread->isPaused()) || (video_thread && video_thread->isPaused()); -#if 0 - bool p = false; - if (_audio) - p |= _audio->isPaused(); - if (_renderer) - p |= _renderer->isPaused(); - return p; -#endif } bool AVPlayer::isLoaded() const @@ -549,6 +532,10 @@ void AVPlayer::setupAudioThread() _audio = new AOPortAudio(); #endif } + if (!_audio) { + masterClock()->setClockType(AVClock::ExternalClock); + return; + } _audio->setSampleRate(aCodecCtx->sample_rate); _audio->setChannels(aCodecCtx->channels); if (!_audio->open()) {