summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-01-05 11:13:08 -0800
committerAndreas Huber <andih@google.com>2010-01-05 11:13:08 -0800
commita66a27e07423c6ed1dde9c0267b555e83c44e58e (patch)
tree298388b54762fc64681098f6c8473c2d16287536
parentb8f92e8fc059693f0b857a185a183f618c4defb0 (diff)
downloadframeworks_av-a66a27e07423c6ed1dde9c0267b555e83c44e58e.zip
frameworks_av-a66a27e07423c6ed1dde9c0267b555e83c44e58e.tar.gz
frameworks_av-a66a27e07423c6ed1dde9c0267b555e83c44e58e.tar.bz2
Protect against possible temporary objects going away before we get at their data.
-rw-r--r--media/libstagefright/codecs/aacdec/AACDecoder.cpp3
-rw-r--r--media/libstagefright/codecs/avc/dec/AVCDecoder.cpp3
-rw-r--r--media/libstagefright/codecs/m4v_h263/dec/M4vH263Decoder.cpp5
3 files changed, 7 insertions, 4 deletions
diff --git a/media/libstagefright/codecs/aacdec/AACDecoder.cpp b/media/libstagefright/codecs/aacdec/AACDecoder.cpp
index 92059c5..ff51e88 100644
--- a/media/libstagefright/codecs/aacdec/AACDecoder.cpp
+++ b/media/libstagefright/codecs/aacdec/AACDecoder.cpp
@@ -70,7 +70,8 @@ status_t AACDecoder::start(MetaData *params) {
uint32_t type;
const void *data;
size_t size;
- if (mSource->getFormat()->findData(kKeyESDS, &type, &data, &size)) {
+ sp<MetaData> meta = mSource->getFormat();
+ if (meta->findData(kKeyESDS, &type, &data, &size)) {
ESDS esds((const char *)data, size);
CHECK_EQ(esds.InitCheck(), OK);
diff --git a/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp b/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
index 22e6188..229e933 100644
--- a/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
+++ b/media/libstagefright/codecs/avc/dec/AVCDecoder.cpp
@@ -90,7 +90,8 @@ status_t AVCDecoder::start(MetaData *) {
uint32_t type;
const void *data;
size_t size;
- if (mSource->getFormat()->findData(kKeyAVCC, &type, &data, &size)) {
+ sp<MetaData> meta = mSource->getFormat();
+ if (meta->findData(kKeyAVCC, &type, &data, &size)) {
// Parse the AVCDecoderConfigurationRecord
const uint8_t *ptr = (const uint8_t *)data;
diff --git a/media/libstagefright/codecs/m4v_h263/dec/M4vH263Decoder.cpp b/media/libstagefright/codecs/m4v_h263/dec/M4vH263Decoder.cpp
index ec3ad47..40009f8 100644
--- a/media/libstagefright/codecs/m4v_h263/dec/M4vH263Decoder.cpp
+++ b/media/libstagefright/codecs/m4v_h263/dec/M4vH263Decoder.cpp
@@ -87,7 +87,8 @@ status_t M4vH263Decoder::start(MetaData *) {
CHECK(!mStarted);
const char *mime = NULL;
- CHECK(mSource->getFormat()->findCString(kKeyMIMEType, &mime));
+ sp<MetaData> meta = mSource->getFormat();
+ CHECK(meta->findCString(kKeyMIMEType, &mime));
MP4DecodingMode mode;
if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_MPEG4, mime)) {
@@ -102,7 +103,7 @@ status_t M4vH263Decoder::start(MetaData *) {
size_t size = 0;
uint8_t *vol_data[1] = {0};
int32_t vol_size = 0;
- if (mSource->getFormat()->findData(kKeyESDS, &type, &data, &size)) {
+ if (meta->findData(kKeyESDS, &type, &data, &size)) {
ESDS esds((const uint8_t *)data, size);
CHECK_EQ(esds.InitCheck(), OK);