From a29a9e05fb4bb14d9cfcc4e15e8773055e0164a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sun, 27 Jan 2008 13:08:14 +0000 Subject: [PATCH] I think this change fixed some trouble I had with MediaPlayer on a system with an unsupported sound card or the like, the fSoundOutput initialization is checked in more places. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23764 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/mediaplayer/Controller.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/apps/mediaplayer/Controller.cpp b/src/apps/mediaplayer/Controller.cpp index 968ad7cf02..c37b1f4c6e 100644 --- a/src/apps/mediaplayer/Controller.cpp +++ b/src/apps/mediaplayer/Controller.cpp @@ -886,7 +886,7 @@ printf("audio format changed, new buffer duration %Ld\n", bufferDuration); // TODO: fix performance time update (in case no audio) if (fTimeSourceLock.Lock()) { - audioLatency = fSoundOutput->Latency(); + audioLatency = fSoundOutput ? fSoundOutput->Latency() : 0; fTimeSourceSysTime = system_time() + audioLatency - bufferDuration; fTimeSourcePerfTime = buffer->startTime; fTimeSourceLock.Unlock(); @@ -895,7 +895,8 @@ printf("audio format changed, new buffer duration %Ld\n", bufferDuration); // fTimeSourcePerfTime); if (fSoundOutput) { - fSoundOutput->Play(buffer->buffer, buffer->sizeUsed); + if (fSoundOutput->InitCheck() >= B_OK) + fSoundOutput->Play(buffer->buffer, buffer->sizeUsed); _UpdatePosition(buffer->startTime); } @@ -1048,6 +1049,7 @@ printf("video decode start\n"); fTimeSourceLock.Unlock(); } else { // puhh... + return; } #if 0 @@ -1220,7 +1222,8 @@ Controller::_UpdatePosition(bigtime_t position, bool isVideoPosition, bool force return; // prefer audio position over video position - if (isVideoPosition && fAudioSupplier) + if (isVideoPosition && (fAudioSupplier && fSoundOutput + && fSoundOutput->InitCheck() >= B_OK)) return; // BAutolock _(fTimeSourceLock);