From b47468e6057942ee9ae5cee1e2b02e2d30cbe30a Mon Sep 17 00:00:00 2001 From: Leena Winterrowd Date: Wed, 24 Sep 2014 14:49:17 -0700 Subject: libstagefright: Allow multi-byte CSD sizes for non-m4v clips As per ISO/IEC 14496-15, there is no explicit limit on the size of codec-specific-data for AVC clips. Only mpeg4 video requires that CSD size must fit within a single byte. Make the assertion enforcing this condition specific to m4v content. CRs-Fixed: 724526 Change-Id: Id006030ac65d5ec0bf285c040e4c536039f9489b --- media/libstagefright/MPEG4Writer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'media/libstagefright/MPEG4Writer.cpp') diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp index df37ea8..ed22ade 100644 --- a/media/libstagefright/MPEG4Writer.cpp +++ b/media/libstagefright/MPEG4Writer.cpp @@ -2811,8 +2811,6 @@ void MPEG4Writer::Track::writeVideoFourCCBox() { mOwner->writeInt16(0x18); // depth mOwner->writeInt16(-1); // predefined - CHECK_LT(23 + mCodecSpecificDataSize, 128); - if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_MPEG4, mime)) { writeMp4vEsdsBox(); } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_H263, mime)) { @@ -2906,6 +2904,9 @@ void MPEG4Writer::Track::writeMp4vEsdsBox() { CHECK_GT(mCodecSpecificDataSize, 0); mOwner->beginBox("esds"); + // Make sure all sizes encode to a single byte. + CHECK_LT(mCodecSpecificDataSize + 23, 128); + mOwner->writeInt32(0); // version=0, flags=0 mOwner->writeInt8(0x03); // ES_DescrTag -- cgit v1.1