author | bipolar <bipolar> | 2002-02-01 18:41:28 (UTC) |
---|---|---|
committer | bipolar <bipolar> | 2002-02-01 18:41:28 (UTC) |
commit | 190a0111ccd874923bf88dac938531a18f52e698 (patch) (unidiff) | |
tree | 422dcb8c17724eb061624f442f0fa6a3116d789b /core/multimedia/opieplayer/loopcontrol.cpp | |
parent | 9a8990097aa35d28a9c758f730c5c8b5fa59560a (diff) | |
download | opie-190a0111ccd874923bf88dac938531a18f52e698.zip opie-190a0111ccd874923bf88dac938531a18f52e698.tar.gz opie-190a0111ccd874923bf88dac938531a18f52e698.tar.bz2 |
Mediaplayer hang fix
Diffstat (limited to 'core/multimedia/opieplayer/loopcontrol.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index 93a6e3f..6dfd057 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp | |||
@@ -227,9 +227,9 @@ void LoopControl::startAudio() { | |||
227 | if ( currentSample != audioSampleCounter + 1 ) | 227 | if ( currentSample != audioSampleCounter + 1 ) |
228 | qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); | 228 | qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); |
229 | 229 | ||
230 | long samplesRead = 0; | 230 | long samplesRead = 0; |
231 | mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); | 231 | bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); |
232 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; | 232 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; |
233 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; | 233 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; |
234 | 234 | ||
235 | if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { | 235 | if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { |
@@ -242,9 +242,9 @@ void LoopControl::startAudio() { | |||
242 | 242 | ||
243 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); | 243 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); |
244 | audioSampleCounter = currentSample + samplesRead - 1; | 244 | audioSampleCounter = currentSample + samplesRead - 1; |
245 | 245 | ||
246 | moreAudio = audioSampleCounter <= total_audio_samples; | 246 | moreAudio = readOk && (audioSampleCounter <= total_audio_samples); |
247 | 247 | ||
248 | } else { | 248 | } else { |
249 | 249 | ||
250 | moreAudio = FALSE; | 250 | moreAudio = FALSE; |