diff options
author | James Dong <jdong@google.com> | 2010-08-24 09:01:39 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-08-24 09:01:39 -0700 |
commit | 7802b20586643a4138f8d92b73736ae685a36409 (patch) | |
tree | 64cb46160744bb28dd29b9450e353c3700350193 /media/libstagefright | |
parent | eee09313c659b1c97ef6188b6ae4066c87615159 (diff) | |
parent | 3fc01525ff33020d4d82a7fb8ade8cf18baaf4f5 (diff) | |
download | frameworks_base-7802b20586643a4138f8d92b73736ae685a36409.zip frameworks_base-7802b20586643a4138f8d92b73736ae685a36409.tar.gz frameworks_base-7802b20586643a4138f8d92b73736ae685a36409.tar.bz2 |
am 3fc01525: am b755e325: Merge "Only add 4 bytes offset for the output media buffer when SPS is not received for SW AVC encoder" into gingerbread
Merge commit '3fc01525ff33020d4d82a7fb8ade8cf18baaf4f5'
* commit '3fc01525ff33020d4d82a7fb8ade8cf18baaf4f5':
Only add 4 bytes offset for the output media buffer when SPS is not received for SW AVC encoder
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/codecs/avc/enc/AVCEncoder.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp b/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp index 389180c..52a391f 100644 --- a/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp +++ b/media/libstagefright/codecs/avc/enc/AVCEncoder.cpp @@ -338,10 +338,15 @@ status_t AVCEncoder::read( MediaBuffer *outputBuffer; CHECK_EQ(OK, mGroup->acquire_buffer(&outputBuffer)); - - // Add 4 bytes for the start code 0x00000001 - uint8_t *outPtr = (uint8_t *) outputBuffer->data() + 4; - uint32_t dataLength = outputBuffer->size() - 4; + uint8_t *outPtr = (uint8_t *) outputBuffer->data(); + uint32_t dataLength = outputBuffer->size(); + + if (!mSpsPpsHeaderReceived && mNumInputFrames < 0) { + // 4 bytes are reserved for holding the start code 0x00000001 + // of the sequence parameter set at the beginning. + outPtr += 4; + dataLength -= 4; + } int32_t type; AVCEnc_Status encoderStatus = AVCENC_SUCCESS; @@ -358,7 +363,7 @@ status_t AVCEncoder::read( switch (type) { case AVC_NALTYPE_SPS: ++mNumInputFrames; - memcpy(outputBuffer->data(), "\x00\x00\x00\x01", 4); + memcpy((uint8_t *)outputBuffer->data(), "\x00\x00\x00\x01", 4); outputBuffer->set_range(0, dataLength + 4); outPtr += (dataLength + 4); // 4 bytes for next start code dataLength = outputBuffer->size() - |