summaryrefslogtreecommitdiffstats
path: root/media/libstagefright
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-09-23 14:16:48 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-09-23 14:16:48 -0700
commit7b2ed5d7d607e435b88ea75db3a1a43a00a86275 (patch)
tree9eaf11265c3a8247dc8e9fad762840b13e24d2c6 /media/libstagefright
parent045398e6243fa4e83fb6435df4e8ffc6a7487a70 (diff)
parente7635933b6f3aa1e306f13663fd52b0210f0e98a (diff)
downloadframeworks_base-7b2ed5d7d607e435b88ea75db3a1a43a00a86275.zip
frameworks_base-7b2ed5d7d607e435b88ea75db3a1a43a00a86275.tar.gz
frameworks_base-7b2ed5d7d607e435b88ea75db3a1a43a00a86275.tar.bz2
Merge "Depending on our preference to write 2-byte or 4-byte NALs, patch the codec specific data 'avcC' accordingly." into gingerbread
Diffstat (limited to 'media/libstagefright')
-rw-r--r--media/libstagefright/MPEG4Writer.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index f0d8943..ba1e218 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -2111,7 +2111,15 @@ void MPEG4Writer::Track::writeTrackHeader(
mOwner->endBox(); // d263
} else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_AVC, mime)) {
CHECK(mCodecSpecificData);
- CHECK(mCodecSpecificDataSize > 0);
+ CHECK(mCodecSpecificDataSize >= 5);
+
+ // Patch avcc's lengthSize field to match the number
+ // of bytes we use to indicate the size of a nal unit.
+ uint8_t *ptr = (uint8_t *)mCodecSpecificData;
+ ptr[4] =
+ (ptr[4] & 0xfc)
+ | (mOwner->useNalLengthFour() ? 3 : 1);
+
mOwner->beginBox("avcC");
mOwner->write(mCodecSpecificData, mCodecSpecificDataSize);
mOwner->endBox(); // avcC