summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-05-20 17:55:52 -0700
committerJames Dong <jdong@google.com>2010-05-20 18:02:52 -0700
commite136c3bb38e88315bf8797a464ebf2c788296b22 (patch)
treec978a5038df7663487fa0ae3bbaadb8517d38f99 /media
parent64105f956f15969dbe1ec7319f6caa2a984e588b (diff)
downloadframeworks_av-e136c3bb38e88315bf8797a464ebf2c788296b22.zip
frameworks_av-e136c3bb38e88315bf8797a464ebf2c788296b22.tar.gz
frameworks_av-e136c3bb38e88315bf8797a464ebf2c788296b22.tar.bz2
Properly handle start code in H264/AVC encoder output
- Some H264/AVC encoder output start code in each output buffer, and others don't. This patch always strips the start code first so that the sample contains the correct size. - Also properly initialize the interleave duration. Change-Id: I692043ce7e38f0215e1097aad9e847a57907b6e4
Diffstat (limited to 'media')
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.cpp1
-rw-r--r--media/libstagefright/MPEG4Writer.cpp4
2 files changed, 3 insertions, 2 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index de64714..572389f 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -701,6 +701,7 @@ status_t StagefrightRecorder::reset() {
mSampleRate = 8000;
mAudioChannels = 1;
mAudioBitRate = 12200;
+ mInterleaveDurationUs = 0;
mOutputFd = -1;
mFlags = 0;
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index 094059d..e0f8f9e 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -334,8 +334,6 @@ static void StripStartcode(MediaBuffer *buffer) {
}
off_t MPEG4Writer::addLengthPrefixedSample_l(MediaBuffer *buffer) {
- StripStartcode(buffer);
-
off_t old_offset = mOffset;
size_t length = buffer->range_length();
@@ -827,6 +825,8 @@ void MPEG4Writer::Track::threadEntry() {
continue;
}
+ if (is_avc) StripStartcode(buffer);
+
SampleInfo info;
info.size = is_avc
#if USE_NALLEN_FOUR