Skip to content
Browse files

changed: drain audio device then flush instead of adding silence

This is a revert of adding silence in case of timeouts on input queue.
  • Loading branch information...
1 parent eac52fe commit 8649a2d7332d8b7e337184cc92dcc0e90db823fe @elupus elupus committed Nov 26, 2011
Showing with 9 additions and 12 deletions.
  1. +9 −12 xbmc/cores/dvdplayer/DVDPlayerAudio.cpp
View
21 xbmc/cores/dvdplayer/DVDPlayerAudio.cpp
@@ -386,18 +386,12 @@ int CDVDPlayerAudio::DecodeFrame(DVDAudioFrame &audioframe, bool bDropPacket)
CDVDMsg* pMsg;
int priority = (m_speed == DVD_PLAYSPEED_PAUSE && m_started) ? 1 : 0;
- int timeout;
- double cached = m_dvdAudio.GetCacheTime();
- if(cached > 0.0 && m_speed == DVD_PLAYSPEED_NORMAL)
- {
- if(cached > 0.2)
- timeout = (int)(1000 * (cached - 0.2));
- else
- timeout = 0; /* in a hurry, try to fill with something as soon as possible */
- }
+ int timeout;
+ if(m_duration > 0)
+ timeout = (int)(1000 * (m_duration / DVD_TIME_BASE + m_dvdAudio.GetCacheTime()));
else
- timeout = 1000; /* if nothing cached, we can just as well wait for a while */
+ timeout = 1000;
// read next packet and return -1 on error
MsgQueueReturnCode ret = m_messageQueue.Get(&pMsg, timeout, priority);
@@ -556,9 +550,12 @@ void CDVDPlayerAudio::Process()
{
m_stalled = true;
- // Add some silence to keep renderer from draining
+ // Flush as the audio output may keep looping if we don't
if(m_speed == DVD_PLAYSPEED_NORMAL)
- m_dvdAudio.AddSilence(0.5);
+ {
+ m_dvdAudio.Drain();
+ m_dvdAudio.Flush();
+ }
continue;
}

4 comments on commit 8649a2d

@arnova
Team Kodi member
arnova commented on 8649a2d Nov 28, 2011

So we're not going to fix this in Windows's DirectSound renderer after all?

And are we keeping CDVDAudio::AddSilence() as an unused function for now?

@elupus
Team Kodi member
@elupus
Team Kodi member
elupus commented on 8649a2d Nov 28, 2011

Had a look and it surly wasn't easy to fix. We'd need another thread to handle the under-run situation. I think the add silence approach technically is better. But i think the AE stuff will change that anyway (even if i think the AE branch is a bit of using a sledge hammer to hit a tiny nail)

@arnova
Team Kodi member
arnova commented on 8649a2d Jan 16, 2012

@elupus: FYI there's also still another related issue on Windows (I hardly ever use Windows but I noticed it at a friend's place, and reproduced it at home). When a movie finishes the audio also momentarily loops (probably due to a/v inter-delay) which sounds rather nasty. Maybe there's a quick fix for this too?

Please sign in to comment.
Something went wrong with that request. Please try again.