summaryrefslogtreecommitdiffstats
path: root/media
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
commit1f78badb5398c17526be021e3c9e3c4aa24536ec (patch)
treec8630919d6d4522b169fc0c56d6fcf97669d90c0 /media
parent59f63db5d1cdc91336a2b82e195e0000091cd6e3 (diff)
parent95fcef25b48e35b625899288971ab628efbf8584 (diff)
downloadframeworks_av-1f78badb5398c17526be021e3c9e3c4aa24536ec.zip
frameworks_av-1f78badb5398c17526be021e3c9e3c4aa24536ec.tar.gz
frameworks_av-1f78badb5398c17526be021e3c9e3c4aa24536ec.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')
-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