Skip to content
This repository has been archived by the owner on Sep 30, 2018. It is now read-only.

Commit

Permalink
[droid] changed, use Pop instead of Shift when we can on the rest in …
Browse files Browse the repository at this point in the history
…SoftAe.cpp
  • Loading branch information
davilla authored and Cory Fields committed Aug 3, 2012
1 parent 9e68714 commit e4b891a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp
Expand Up @@ -1060,7 +1060,12 @@ int CSoftAE::RunRawOutputStage(bool hasAudio)
m_reOpen = true;
}

m_buffer.Shift(NULL, wroteFrames * m_sinkFormat.m_frameSize);
unsigned int wroteBytes = wroteFrames * m_sinkFormat.m_frameSize;
if (m_buffer.Used() == wroteBytes)
m_buffer.Pop(NULL, wroteBytes);
else
m_buffer.Shift(NULL, wroteBytes);

return wroteFrames;
}

Expand Down Expand Up @@ -1096,7 +1101,11 @@ int CSoftAE::RunTranscodeStage(bool hasAudio)
buffer = m_buffer.Raw(block);

encodedFrames = m_encoder->Encode((float*)buffer, m_encoderFormat.m_frames);
m_buffer.Shift(NULL, encodedFrames * m_encoderFormat.m_frameSize);
unsigned int encodedBytes = encodedFrames * m_encoderFormat.m_frameSize;
if (m_buffer.Used() == encodedBytes)
m_buffer.Pop(NULL, encodedBytes);
else
m_buffer.Shift(NULL, encodedBytes);

uint8_t *packet;
unsigned int size = m_encoder->GetData(&packet);
Expand All @@ -1121,7 +1130,11 @@ int CSoftAE::RunTranscodeStage(bool hasAudio)
m_reOpen = true;
}

m_encodedBuffer.Shift(NULL, wroteFrames * m_sinkFormat.m_frameSize);
unsigned int wroteBytes = wroteFrames * m_sinkFormat.m_frameSize;
if (m_encodedBuffer.Used() == wroteBytes)
m_encodedBuffer.Pop(NULL, wroteBytes);
else
m_encodedBuffer.Shift(NULL, wroteBytes);
}
return encodedFrames;
}
Expand Down

0 comments on commit e4b891a

Please sign in to comment.