Skip to content

Commit

Permalink
fix audio buffer overflow while playing streamed contents
Browse files Browse the repository at this point in the history
  • Loading branch information
christiantroy committed Jun 21, 2012
1 parent e0a86aa commit 5e1fa21
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions media/libstagefright/ACodec.cpp
Expand Up @@ -1817,8 +1817,12 @@ void ACodec::BaseState::onInputBufferFilled(const sp<AMessage> &msg) {
mCodec->mComponentName.c_str());
}

CHECK_LE(buffer->size(), info->mData->capacity());
memcpy(info->mData->data(), buffer->data(), buffer->size());
//CHECK_LE(buffer->size(), info->mData->capacity());
//memcpy(info->mData->data(), buffer->data(), buffer->size());
if (buffer->size() > info->mData->capacity())
memcpy(info->mData->data(), buffer->data(), info->mData->capacity());
else
memcpy(info->mData->data(), buffer->data(), buffer->size());
}

if (flags & OMX_BUFFERFLAG_CODECCONFIG) {
Expand Down

0 comments on commit 5e1fa21

Please sign in to comment.