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 | |
parent | 9a8990097aa35d28a9c758f730c5c8b5fa59560a (diff) | |
download | opie-190a0111ccd874923bf88dac938531a18f52e698.zip opie-190a0111ccd874923bf88dac938531a18f52e698.tar.gz opie-190a0111ccd874923bf88dac938531a18f52e698.tar.bz2 |
Mediaplayer hang fix
-rw-r--r-- | core/multimedia/opieplayer/libmad/libmadplugin.cpp | 8 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 4 | ||||
-rw-r--r-- | core/multimedia/opieplayer/wavplugin/wavplugin.cpp | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp index b2b876f..9d04f7e 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp +++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp | |||
@@ -492,23 +492,23 @@ bool LibMadPlugin::audioReadSamples( short *output, int /*channels*/, long sampl | |||
492 | 492 | ||
493 | static bool needInput = TRUE; | 493 | static bool needInput = TRUE; |
494 | 494 | ||
495 | if ( samples == 0 ) | 495 | if ( samples == 0 ) |
496 | return TRUE; | 496 | return FALSE; |
497 | 497 | ||
498 | do { | 498 | do { |
499 | if ( needInput ) | 499 | if ( needInput ) |
500 | if ( !read() ) { | 500 | if ( !read() ) { |
501 | // if ( d->input.eof ) | 501 | // if ( d->input.eof ) |
502 | // needInput = FALSE; | 502 | // needInput = FALSE; |
503 | // else | 503 | // else |
504 | return TRUE; | 504 | return FALSE; |
505 | } | 505 | } |
506 | 506 | ||
507 | needInput = FALSE; | 507 | needInput = FALSE; |
508 | 508 | ||
509 | if ( decode( output, samples, samplesMade ) ) | 509 | if ( decode( output, samples, samplesMade ) ) |
510 | return FALSE; | 510 | return TRUE; |
511 | else | 511 | else |
512 | needInput = TRUE; | 512 | needInput = TRUE; |
513 | } | 513 | } |
514 | while ( ( samplesMade < samples ) && ( !d->input.eof ) ); | 514 | while ( ( samplesMade < samples ) && ( !d->input.eof ) ); |
@@ -520,9 +520,9 @@ bool LibMadPlugin::audioReadSamples( short *output, int /*channels*/, long sampl | |||
520 | decode( output, samples, samplesMade ); | 520 | decode( output, samples, samplesMade ); |
521 | return FALSE; | 521 | return FALSE; |
522 | } else | 522 | } else |
523 | */ | 523 | */ |
524 | return TRUE; | 524 | return FALSE; |
525 | } | 525 | } |
526 | 526 | ||
527 | 527 | ||
528 | double LibMadPlugin::getTime() { | 528 | double LibMadPlugin::getTime() { |
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; |
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp index 60a0024..a6bd974 100644 --- a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp +++ b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp | |||
@@ -322,9 +322,9 @@ bool WavPlugin::audioReadStereoSamples( short *output, long samples, long& sampl | |||
322 | */ | 322 | */ |
323 | 323 | ||
324 | bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { | 324 | bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { |
325 | debugMsg( "WavPlugin::audioReadSamples" ); | 325 | debugMsg( "WavPlugin::audioReadSamples" ); |
326 | return !d->add( output, samples, samplesMade, channels != 1 ); | 326 | return d->add( output, samples, samplesMade, channels != 1 ); |
327 | } | 327 | } |
328 | 328 | ||
329 | double WavPlugin::getTime() { | 329 | double WavPlugin::getTime() { |
330 | debugMsg( "WavPlugin::getTime" ); | 330 | debugMsg( "WavPlugin::getTime" ); |