summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/loopcontrol.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/loopcontrol.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index 6f86b4a..3171c4b 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -216,56 +216,56 @@ void LoopControl::startVideo() {
216 216
217 } 217 }
218} 218}
219 219
220 220
221void LoopControl::startAudio() { 221void LoopControl::startAudio() {
222 222
223//qDebug("start audio"); 223//qDebug("start audio");
224 audioMutex->lock(); 224 audioMutex->lock();
225 if ( moreAudio ) { 225 if ( moreAudio ) {
226 226
227 if ( !isMuted && mediaPlayerState->curDecoder() ) { 227 if ( !isMuted && mediaPlayerState->curDecoder() ) {
228 228
229 currentSample = audioSampleCounter + 1; 229 currentSample = audioSampleCounter + 1;
230 230
231 if ( currentSample != audioSampleCounter + 1 ) 231 if ( currentSample != audioSampleCounter + 1 )
232 qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); 232 qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter);
233 233
234 long samplesRead = 0; 234 long samplesRead = 0;
235 bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); 235 bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream );
236 long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; 236 long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000;
237 long sampleWaitTime = currentSample - sampleWeShouldBeAt; 237 long sampleWaitTime = currentSample - sampleWeShouldBeAt;
238 238
239// this causes drop outs not sure why its even here 239// this causes drop outs not sure why its even here
240// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { 240 if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) {
241// usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); 241 usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
242// } 242 }
243// else if ( sampleWaitTime <= -5000 ) { 243 else if ( sampleWaitTime <= -5000 ) {
244// qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); 244 qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
245// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); 245// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
246// currentSample = sampleWeShouldBeAt; 246 currentSample = sampleWeShouldBeAt;
247// } 247 }
248 248
249 audioDevice->write( audioBuffer, samplesRead * 2 * channels ); 249 audioDevice->write( audioBuffer, samplesRead * 2 * channels );
250 250
251 if( mediaPlayerState->isStreaming == FALSE) 251 if( mediaPlayerState->isStreaming == FALSE)
252 audioSampleCounter = currentSample + samplesRead - 1; 252 audioSampleCounter = currentSample + samplesRead - 1;
253 253
254 moreAudio = readOk && (audioSampleCounter <= total_audio_samples); 254 moreAudio = readOk && (audioSampleCounter <= total_audio_samples);
255 255
256 } else { 256 } else {
257 257
258 moreAudio = FALSE; 258 moreAudio = FALSE;
259 259
260 } 260 }
261 261
262 } 262 }
263 263
264 audioMutex->unlock(); 264 audioMutex->unlock();
265} 265}
266 266
267 267
268void LoopControl::killTimers() { 268void LoopControl::killTimers() {
269 269
270 audioMutex->lock(); 270 audioMutex->lock();
271 271