mirror of
https://projects.vdr-developer.org/git/vdr-plugin-softhddevice.git
synced 2023-10-10 19:16:51 +02:00
Buffertime compile time configurable in ms.
This commit is contained in:
parent
fa27a1c73a
commit
bd7e6143c7
@ -1,4 +1,8 @@
|
||||
User johns
|
||||
Data:
|
||||
|
||||
Buffertime compile time configurable in ms.
|
||||
|
||||
Date: Sat Jan 21 15:49:16 CET 2012
|
||||
|
||||
Release Version 0.4.0
|
||||
|
28
audio.c
28
audio.c
@ -136,6 +136,7 @@ static unsigned AudioSampleRate; ///< audio sample rate in hz
|
||||
static unsigned AudioChannels; ///< number of audio channels
|
||||
static const int AudioBytesProSample = 2; ///< number of bytes per sample
|
||||
static int64_t AudioPTS; ///< audio pts clock
|
||||
static const int AudioBufferTime = 350; ///< audio buffer time in ms
|
||||
|
||||
#ifdef USE_AUDIO_THREAD
|
||||
static pthread_t AudioThread; ///< audio play thread
|
||||
@ -574,6 +575,8 @@ static void AlsaEnqueue(const void *samples, int count)
|
||||
|
||||
// direct play produces underuns on some hardware
|
||||
|
||||
#ifndef USE_AUDIO_THREAD
|
||||
|
||||
/**
|
||||
** Place samples in audio output queue.
|
||||
**
|
||||
@ -587,6 +590,8 @@ static void AlsaEnqueue(const void *samples, int count)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_AUDIO_THREAD
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@ -1070,9 +1075,12 @@ static int AlsaSetup(int *freq, int *channels)
|
||||
snd_pcm_state_name(snd_pcm_state(AlsaPCMHandle)));
|
||||
|
||||
AlsaStartThreshold = snd_pcm_frames_to_bytes(AlsaPCMHandle, period_size);
|
||||
// min 333ms
|
||||
if (AlsaStartThreshold < (*freq * *channels * AudioBytesProSample) / 3U) {
|
||||
AlsaStartThreshold = (*freq * *channels * AudioBytesProSample) / 3U;
|
||||
// buffer time/delay in ms
|
||||
if (AlsaStartThreshold <
|
||||
(*freq * *channels * AudioBytesProSample * AudioBufferTime) / 1000U) {
|
||||
AlsaStartThreshold =
|
||||
(*freq * *channels * AudioBytesProSample * AudioBufferTime) /
|
||||
1000U;
|
||||
}
|
||||
// no bigger, than the buffer
|
||||
if (AlsaStartThreshold > RingBufferFreeBytes(AlsaRingBuffer)) {
|
||||
@ -1286,6 +1294,8 @@ static void OssFlushBuffers(void)
|
||||
// OSS pcm polled
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#ifndef USE_AUDIO_THREAD
|
||||
|
||||
/**
|
||||
** Place samples in audio output queue.
|
||||
**
|
||||
@ -1312,6 +1322,8 @@ static void OssEnqueue(const void *samples, int count)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
** Play all samples possible, without blocking.
|
||||
*/
|
||||
@ -1656,9 +1668,13 @@ static int OssSetup(int *freq, int *channels)
|
||||
}
|
||||
// start when enough bytes for initial write
|
||||
OssStartThreshold = bi.bytes + tmp;
|
||||
// min 333ms
|
||||
if (OssStartThreshold < (*freq * *channels * AudioBytesProSample) / 3U) {
|
||||
OssStartThreshold = (*freq * *channels * AudioBytesProSample) / 3U;
|
||||
// buffer time/delay in ms
|
||||
if (OssStartThreshold <
|
||||
(*freq * *channels * AudioBytesProSample * AudioBufferTime) /
|
||||
1000U) {
|
||||
OssStartThreshold =
|
||||
(*freq * *channels * AudioBytesProSample * AudioBufferTime) /
|
||||
1000U;
|
||||
}
|
||||
// no bigger, than the buffer
|
||||
if (OssStartThreshold > RingBufferFreeBytes(OssRingBuffer)) {
|
||||
|
Loading…
Reference in New Issue
Block a user