summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MPEG2TSWriter.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2012-02-21 14:38:23 -0800
committerAndreas Huber <andih@google.com>2012-02-22 16:20:59 -0800
commit2d8bedd05437b6fccdbc6bf70f673ffd86744d59 (patch)
tree1a11658a7379249eb4f6bd73b356baa4a661f41e /media/libstagefright/MPEG2TSWriter.cpp
parent79af02c6a813b5d31fba3e7b72686a02f0ae7e0f (diff)
downloadframeworks_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/MPEG2TSWriter.cpp')
-rw-r--r--media/libstagefright/MPEG2TSWriter.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/media/libstagefright/MPEG2TSWriter.cpp b/media/libstagefright/MPEG2TSWriter.cpp
index 0b4ecbe..f702376 100644
--- a/media/libstagefright/MPEG2TSWriter.cpp
+++ b/media/libstagefright/MPEG2TSWriter.cpp
@@ -244,7 +244,7 @@ void MPEG2TSWriter::SourceInfo::extractCodecSpecificData() {
sp<AMessage> notify = mNotify->dup();
notify->setInt32("what", kNotifyBuffer);
- notify->setObject("buffer", out);
+ notify->setBuffer("buffer", out);
notify->setInt32("oob", true);
notify->post();
}
@@ -270,7 +270,7 @@ void MPEG2TSWriter::SourceInfo::postAVCFrame(MediaBuffer *buffer) {
copy->meta()->setInt32("isSync", true);
}
- notify->setObject("buffer", copy);
+ notify->setBuffer("buffer", copy);
notify->post();
}
@@ -351,7 +351,7 @@ bool MPEG2TSWriter::SourceInfo::flushAACFrames() {
sp<AMessage> notify = mNotify->dup();
notify->setInt32("what", kNotifyBuffer);
- notify->setObject("buffer", mAACBuffer);
+ notify->setBuffer("buffer", mAACBuffer);
notify->post();
mAACBuffer.clear();
@@ -614,10 +614,8 @@ void MPEG2TSWriter::onMessageReceived(const sp<AMessage> &msg) {
++mNumSourcesDone;
} else if (what == SourceInfo::kNotifyBuffer) {
- sp<RefBase> obj;
- CHECK(msg->findObject("buffer", &obj));
-
- sp<ABuffer> buffer = static_cast<ABuffer *>(obj.get());
+ sp<ABuffer> buffer;
+ CHECK(msg->findBuffer("buffer", &buffer));
int32_t oob;
if (msg->findInt32("oob", &oob) && oob) {