summaryrefslogtreecommitdiff
path: root/audio.c
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2012-01-27 21:08:37 +0100
committerJohns <johns98@gmx.net>2012-01-27 21:08:37 +0100
commitf8d198636b5291f4328d5b3f572cc084b68bda87 (patch)
tree4260766f22c6722712bc7f6ac32acf8e6d7af012 /audio.c
parentbcf6ecabc1ca83d8f6de578ee2d25ad162518981 (diff)
downloadvdr-plugin-softhddevice-f8d198636b5291f4328d5b3f572cc084b68bda87.tar.gz
vdr-plugin-softhddevice-f8d198636b5291f4328d5b3f572cc084b68bda87.tar.bz2
Video bug fix.
Made video_test working again. Disabled VA-API Intel vaAssociateSubpicture workaround. Fix bug: Must release lock for VideoPollEvent. Allow faster video and audio sync. Fix bug: Software decoder use vaPutImage with Intel backend. Fix bug: Artefacts are shown after mpeg2 channel switch. Fix bug: VideoReleaseSurface called after VideoExit.
Diffstat (limited to 'audio.c')
-rw-r--r--audio.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/audio.c b/audio.c
index 5ccb924..2142b5a 100644
--- a/audio.c
+++ b/audio.c
@@ -137,7 +137,8 @@ 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
+static const int AudioBufferTime = 300; ///< audio buffer time in ms
+static int AudioMoreBufferTime = 1; ///< increase buffer time
#ifdef USE_AUDIO_THREAD
static pthread_t AudioThread; ///< audio play thread
@@ -1086,11 +1087,13 @@ static int AlsaSetup(int *freq, int *channels, int use_ac3)
AlsaStartThreshold = snd_pcm_frames_to_bytes(AlsaPCMHandle, period_size);
// buffer time/delay in ms
if (AlsaStartThreshold <
- (*freq * *channels * AudioBytesProSample * AudioBufferTime) / 1000U) {
+ (*freq * *channels * AudioBytesProSample * AudioMoreBufferTime *
+ AudioBufferTime) / 1000U) {
AlsaStartThreshold =
- (*freq * *channels * AudioBytesProSample * AudioBufferTime) /
- 1000U;
+ (*freq * *channels * AudioBytesProSample * AudioMoreBufferTime *
+ AudioBufferTime) / 1000U;
}
+ AudioMoreBufferTime = 1;
// no bigger, than the buffer
if (AlsaStartThreshold > RingBufferFreeBytes(AlsaRingBuffer)) {
AlsaStartThreshold = RingBufferFreeBytes(AlsaRingBuffer);
@@ -1709,12 +1712,13 @@ static int OssSetup(int *freq, int *channels, int use_ac3)
OssStartThreshold = bi.bytes + tmp;
// buffer time/delay in ms
if (OssStartThreshold <
- (*freq * *channels * AudioBytesProSample * AudioBufferTime) /
- 1000U) {
+ (*freq * *channels * AudioBytesProSample * AudioMoreBufferTime *
+ AudioBufferTime) / 1000U) {
OssStartThreshold =
- (*freq * *channels * AudioBytesProSample * AudioBufferTime) /
- 1000U;
+ (*freq * *channels * AudioBytesProSample *
+ AudioMoreBufferTime * AudioBufferTime) / 1000U;
}
+ AudioMoreBufferTime = 1;
// no bigger, than the buffer
if (OssStartThreshold > RingBufferFreeBytes(OssRingBuffer)) {
OssStartThreshold = RingBufferFreeBytes(OssRingBuffer);
@@ -2098,6 +2102,16 @@ int AudioSetup(int *freq, int *channels, int use_ac3)
}
/**
+** Increase audio buffer time.
+**
+** Some channels need a bigger audio buffer to buffer video.
+*/
+void AudioIncreaseBufferTime(void)
+{
+ AudioMoreBufferTime = 4;
+}
+
+/**
** Set pcm audio device.
**
** @param device name of pcm device (fe. "hw:0,9" or "/dev/dsp")