author | llornkcor <llornkcor> | 2002-04-21 16:13:30 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-21 16:13:30 (UTC) |
commit | 392eb0350465565e2a849ada60e6734be025787b (patch) (side-by-side diff) | |
tree | 44727c201e6ef8e4d61d6011180d41b46c8f4ea4 | |
parent | d7ff40e1530a1aab578a3d3c3126c4367cf3e898 (diff) | |
download | opie-392eb0350465565e2a849ada60e6734be025787b.zip opie-392eb0350465565e2a849ada60e6734be025787b.tar.gz opie-392eb0350465565e2a849ada60e6734be025787b.tar.bz2 |
fix unfixed stream stop
-rw-r--r-- | core/multimedia/opieplayer/audiodevice.cpp | 1 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp index 2087c7f..ad44abb 100644 --- a/core/multimedia/opieplayer/audiodevice.cpp +++ b/core/multimedia/opieplayer/audiodevice.cpp @@ -227,48 +227,49 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { if(ioctl( d->handle, SNDCTL_DSP_SPEED, &d->frequency )==-1) perror("ioctl(\"SNDCTL_DSP_SPEED\")"); qDebug("channels %d",d->channels); if ( ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels ) == -1 ) { d->channels = ( d->channels == 1 ) ? 2 : d->channels; if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1) perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); } d->bufferSize = sound_fragment_bytes; d->unwrittenBuffer = new char[d->bufferSize]; d->unwritten = 0; d->can_GETOSPACE = TRUE; // until we find otherwise //if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels ); //if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency ); //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" ); //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" ); //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" ); //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); } AudioDevice::~AudioDevice() { + qDebug("destryo audiodevice"); #ifdef Q_OS_WIN32 waveOutClose( (HWAVEOUT)d->handle ); #else # ifndef KEEP_DEVICE_OPEN close( d->handle ); // Now it should be safe to shut the handle # endif delete d->unwrittenBuffer; delete d; #endif } void AudioDevice::volumeChanged( bool muted ) { AudioDevicePrivate::muted = muted; } void AudioDevice::write( char *buffer, unsigned int length ) { #ifdef Q_OS_WIN32 // returns immediately and (to be implemented) emits completedIO() when finished writing WAVEHDR *lpWaveHdr = (WAVEHDR *)malloc( sizeof(WAVEHDR) ); // maybe the buffer should be copied so that this fool proof, but its a performance hit diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index 01596a0..7005886 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp @@ -227,49 +227,49 @@ void LoopControl::startAudio() { if ( !isMuted && mediaPlayerState->curDecoder() ) { currentSample = audioSampleCounter + 1; if ( currentSample != audioSampleCounter + 1 ) qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); long samplesRead = 0; bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; long sampleWaitTime = currentSample - sampleWeShouldBeAt; // this causes drop outs not sure why its even here // if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { // usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); // } // else if ( sampleWaitTime <= -5000 ) { // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); // currentSample = sampleWeShouldBeAt; // } audioDevice->write( audioBuffer, samplesRead * 2 * channels ); -// if( mediaPlayerState->isStreaming == FALSE) + if( mediaPlayerState->isStreaming == FALSE) audioSampleCounter = currentSample + samplesRead - 1; moreAudio = readOk && (audioSampleCounter <= total_audio_samples); } else { moreAudio = FALSE; } } audioMutex->unlock(); } void LoopControl::killTimers() { audioMutex->lock(); if ( hasVideoChannel ) killTimer( videoId ); killTimer( sliderId ); threadOkToGo = FALSE; |