Skip to content

Commit

Permalink
fixed, android audio playback
Browse files Browse the repository at this point in the history
  • Loading branch information
davilla committed Jul 6, 2013
1 parent 77ebff3 commit ada4f17
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
Expand Up @@ -217,7 +217,10 @@ unsigned int CAESinkAUDIOTRACK::AddPackets(uint8_t *data, unsigned int frames, b
// write as many frames of audio as we can fit into our internal buffer.

// our internal sink buffer is always AE_FMT_S16LE
unsigned int write_frames = (m_sinkbuffer->GetWriteSize() / m_sink_frameSize) % frames;
unsigned int write_frames = m_sinkbuffer->GetWriteSize() / m_sink_frameSize;
if (write_frames > frames)
write_frames = frames;

if (hasAudio && write_frames)
{
switch(m_format.m_dataFormat)
Expand Down Expand Up @@ -372,7 +375,10 @@ void CAESinkAUDIOTRACK::Process()
jenv->CallVoidMethod(joAudioTrack, jmFlush);
}

unsigned int read_bytes = m_sinkbuffer->GetReadSize() % min_buffer_size;
unsigned int read_bytes = m_sinkbuffer->GetReadSize();
if (read_bytes > min_buffer_size)
read_bytes = min_buffer_size;

if (read_bytes > 0)
{
// android will auto pause the playstate when it senses idle,
Expand Down

0 comments on commit ada4f17

Please sign in to comment.