Skip to content

Commit

Permalink
Remove deprecated SoftIsPlayingVideo parameter in order to fix pesint…
Browse files Browse the repository at this point in the history
  • Loading branch information
rofafor committed Jul 21, 2018
1 parent 05c7de2 commit fa96734
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
21 changes: 3 additions & 18 deletions audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,10 @@ static int AudioStereoDescent; ///< volume descent for stereo
static int AudioVolume; ///< current volume (0 .. 1000)

extern int VideoAudioDelay; ///< import audio/video delay
extern volatile char SoftIsPlayingVideo; ///< stream contains video data

/// default ring buffer size ~2s 8ch 16bit (3 * 5 * 7 * 8)
static const unsigned AudioRingBufferSize = 3 * 5 * 7 * 8 * 2 * 1000;

#define AUDIO_MIN_BUFFER_FREE (3072 * 8 * 8)

static int AudioChannelsInHw[9]; ///< table which channels are supported
enum _audio_rates
{ ///< sample rates enumeration
Expand Down Expand Up @@ -1333,7 +1330,6 @@ static int AudioNextRing(void)
int sample_rate;
int channels;
size_t used;
size_t remain;

// update audio format
// not always needed, but check if needed is too complex
Expand All @@ -1357,13 +1353,7 @@ static int AudioNextRing(void)
/ (AudioRing[AudioRingWrite].HwSampleRate * AudioRing[AudioRingWrite].HwChannels * AudioBytesProSample));

used = RingBufferUsedBytes(AudioRing[AudioRingRead].RingBuffer);
remain = RingBufferFreeBytes(AudioRing[AudioRingRead].RingBuffer);
// stop, if not enough in next buffer
if (remain <= AUDIO_MIN_BUFFER_FREE) {
Debug5("audio: force start");
}
if (remain <= AUDIO_MIN_BUFFER_FREE || ((AudioVideoIsReady || !SoftIsPlayingVideo)
&& AudioStartThreshold < used)) {
if (AudioStartThreshold * 4 < used || (AudioVideoIsReady && AudioStartThreshold < used)) {
return 0;
}
return 1;
Expand Down Expand Up @@ -1590,7 +1580,6 @@ void AudioEnqueue(const void *samples, int count)

if (!AudioRunning) { // check, if we can start the thread
int skip;
size_t remain;

n = RingBufferUsedBytes(AudioRing[AudioRingWrite].RingBuffer);
skip = AudioSkip;
Expand All @@ -1610,12 +1599,8 @@ void AudioEnqueue(const void *samples, int count)
n = RingBufferUsedBytes(AudioRing[AudioRingWrite].RingBuffer);
}
// forced start or enough video + audio buffered
remain = RingBufferFreeBytes(AudioRing[AudioRingRead].RingBuffer);
if (remain <= AUDIO_MIN_BUFFER_FREE) {
Debug5("audio: force start");
}
if (remain <= AUDIO_MIN_BUFFER_FREE || ((AudioVideoIsReady || !SoftIsPlayingVideo)
&& AudioStartThreshold < n)) {
// for some exotic channels * 4 too small
if (AudioStartThreshold * 4 < n || (AudioVideoIsReady && AudioStartThreshold < n)) {
// restart play-back
// no lock needed, can wakeup next time
AudioRunning = 1;
Expand Down
1 change: 0 additions & 1 deletion vaapidevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ static volatile int DoMakePrimary; ///< switch primary device to this
#define SUSPEND_NORMAL 1 ///< normal suspend mode
#define SUSPEND_DETACHED 2 ///< detached suspend mode
static signed char SuspendMode; ///< suspend mode
volatile char SoftIsPlayingVideo; ///< stream contains video data
static cString CommandLineParameters = ""; ///< plugin's command-line parameters

//////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit fa96734

Please sign in to comment.