diff options
author | Andreas Huber <andih@google.com> | 2012-02-21 14:38:23 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2012-02-22 16:20:59 -0800 |
commit | 2d8bedd05437b6fccdbc6bf70f673ffd86744d59 (patch) | |
tree | 1a11658a7379249eb4f6bd73b356baa4a661f41e /media/libstagefright/ACodec.cpp | |
parent | 79af02c6a813b5d31fba3e7b72686a02f0ae7e0f (diff) | |
download | frameworks_av-2d8bedd05437b6fccdbc6bf70f673ffd86744d59.zip frameworks_av-2d8bedd05437b6fccdbc6bf70f673ffd86744d59.tar.gz frameworks_av-2d8bedd05437b6fccdbc6bf70f673ffd86744d59.tar.bz2 |
Add new APIs AMessage::(set|find)Buffer to make it safer to pass
ABuffer objects through messages.
Change-Id: I9f8b4e4c4767d0d70a0105e0c0813b754379b49d
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r-- | media/libstagefright/ACodec.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 605b497..c91fbe6 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -446,7 +446,7 @@ status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) { notify->setPointer(name.c_str(), mBuffers[portIndex][i].mBufferID); name = StringPrintf("data_%d", i); - notify->setObject(name.c_str(), mBuffers[portIndex][i].mData); + notify->setBuffer(name.c_str(), mBuffers[portIndex][i].mData); } notify->post(); @@ -2142,7 +2142,7 @@ void ACodec::BaseState::postFillThisBuffer(BufferInfo *info) { notify->setPointer("buffer-id", info->mBufferID); info->mData->meta()->clear(); - notify->setObject("buffer", info->mData); + notify->setBuffer("buffer", info->mData); sp<AMessage> reply = new AMessage(kWhatInputBufferFilled, mCodec->id()); reply->setPointer("buffer-id", info->mBufferID); @@ -2158,23 +2158,21 @@ void ACodec::BaseState::onInputBufferFilled(const sp<AMessage> &msg) { IOMX::buffer_id bufferID; CHECK(msg->findPointer("buffer-id", &bufferID)); - sp<RefBase> obj; + sp<ABuffer> buffer; int32_t err = OK; bool eos = false; - if (!msg->findObject("buffer", &obj)) { + if (!msg->findBuffer("buffer", &buffer)) { CHECK(msg->findInt32("err", &err)); ALOGV("[%s] saw error %d instead of an input buffer", mCodec->mComponentName.c_str(), err); - obj.clear(); + buffer.clear(); eos = true; } - sp<ABuffer> buffer = static_cast<ABuffer *>(obj.get()); - int32_t tmp; if (buffer != NULL && buffer->meta()->findInt32("eos", &tmp) && tmp) { eos = true; @@ -2374,7 +2372,7 @@ bool ACodec::BaseState::onOMXFillBufferDone( sp<AMessage> notify = mCodec->mNotify->dup(); notify->setInt32("what", ACodec::kWhatDrainThisBuffer); notify->setPointer("buffer-id", info->mBufferID); - notify->setObject("buffer", info->mData); + notify->setBuffer("buffer", info->mData); notify->setInt32("flags", flags); sp<AMessage> reply = |