From 63299c03875f414ff6d5867fbca9a7b11699a644 Mon Sep 17 00:00:00 2001 From: James Dong Date: Wed, 28 Jul 2010 10:08:03 -0700 Subject: Interleave the audio and video by default - default interleave duration is set to 1 second This can dramatically reduce the memory usage by the MP4 file writer. Change-Id: Ia3ff202cabfcd2d3f183065d31e4596617c2dded --- media/libmediaplayerservice/StagefrightRecorder.cpp | 6 ++++-- media/libstagefright/MPEG4Writer.cpp | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp index b56f997..f26676d 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.cpp +++ b/media/libmediaplayerservice/StagefrightRecorder.cpp @@ -981,8 +981,10 @@ status_t StagefrightRecorder::startMPEG4Recording() { totalBitRate += mVideoBitRate; } - reinterpret_cast(writer.get())-> - setInterleaveDuration(mInterleaveDurationUs); + if (mInterleaveDurationUs > 0) { + reinterpret_cast(writer.get())-> + setInterleaveDuration(mInterleaveDurationUs); + } if (mMaxFileDurationUs != 0) { writer->setMaxFileDuration(mMaxFileDurationUs); diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp index c4a25bc..78970b3 100644 --- a/media/libstagefright/MPEG4Writer.cpp +++ b/media/libstagefright/MPEG4Writer.cpp @@ -145,7 +145,7 @@ MPEG4Writer::MPEG4Writer(const char *filename) mOffset(0), mMdatOffset(0), mEstimatedMoovBoxSize(0), - mInterleaveDurationUs(500000) { + mInterleaveDurationUs(1000000) { CHECK(mFile != NULL); } @@ -157,7 +157,7 @@ MPEG4Writer::MPEG4Writer(int fd) mOffset(0), mMdatOffset(0), mEstimatedMoovBoxSize(0), - mInterleaveDurationUs(500000) { + mInterleaveDurationUs(1000000) { CHECK(mFile != NULL); } -- cgit v1.1