Skip to content

Commit

Permalink
Fix timestretch for digital passthrough content.
Browse files Browse the repository at this point in the history
Hopefully 3rd time lucky. Put a lock around the spdif encoder. Increase verbosity if we try to process digital raw audio and drop audio packet
  • Loading branch information
jyavenard committed Apr 28, 2011
1 parent 4f38913 commit 33a7583
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
18 changes: 14 additions & 4 deletions mythtv/libs/libmyth/audiooutputbase.cpp
Expand Up @@ -1246,8 +1246,22 @@ bool AudioOutputBase::AddData(void *in_buffer, int in_len,
Pause(false);
}

// Don't write new samples if we're resetting the buffer or reconfiguring
QMutexLocker lock(&audio_buflock);

if (passthru && m_spdifenc)
{
if (processing)
{
/*
* We shouldn't encounter this case, but it can occur when
* timestretch just got activated. So we will just drop the
* data
*/
VERBOSE(VB_AUDIO, QString("Passthrough activated with audio "
"processing. Dropping audio"));
return false;
}
// mux into an IEC958 packet
m_spdifenc->WriteFrame((unsigned char *)in_buffer, len);
len = m_spdifenc->GetProcessedSize();
Expand All @@ -1268,9 +1282,6 @@ bool AudioOutputBase::AddData(void *in_buffer, int in_len,
.arg(frames).arg(len).arg(used).arg(afree).arg(timecode)
.arg(needs_upmix));

// Don't write new samples if we're resetting the buffer or reconfiguring
QMutexLocker lock(&audio_buflock);

// Mythmusic doesn't give us timestamps
if (timecode < 0)
{
Expand Down Expand Up @@ -1323,7 +1334,6 @@ bool AudioOutputBase::AddData(void *in_buffer, int in_len,
{
buffer = (char *)in_buffer + offset;
frames = frames_remaining;

len = frames * source_bytes_per_frame;

if (processing)
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/audioplayer.cpp
Expand Up @@ -89,6 +89,7 @@ QString AudioPlayer::ReinitAudio(void)
m_codec_profile);
m_audioOutput->Reconfigure(settings);
errMsg = m_audioOutput->GetError();
SetStretchFactor(m_stretchfactor);
}

if (!errMsg.isEmpty())
Expand Down

0 comments on commit 33a7583

Please sign in to comment.