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 'b755e3256510ecd325565d6b461d668d224445b1' into gingerbread-plus-aosp * commit 'b755e3256510ecd325565d6b461d668d224445b1': Only add 4 bytes offset for the output media buffer when SPS is not received for SW AVC encoder
This commit is contained in:
@@ -338,10 +338,15 @@ status_t AVCEncoder::read(
|
|||||||
|
|
||||||
MediaBuffer *outputBuffer;
|
MediaBuffer *outputBuffer;
|
||||||
CHECK_EQ(OK, mGroup->acquire_buffer(&outputBuffer));
|
CHECK_EQ(OK, mGroup->acquire_buffer(&outputBuffer));
|
||||||
|
uint8_t *outPtr = (uint8_t *) outputBuffer->data();
|
||||||
|
uint32_t dataLength = outputBuffer->size();
|
||||||
|
|
||||||
// Add 4 bytes for the start code 0x00000001
|
if (!mSpsPpsHeaderReceived && mNumInputFrames < 0) {
|
||||||
uint8_t *outPtr = (uint8_t *) outputBuffer->data() + 4;
|
// 4 bytes are reserved for holding the start code 0x00000001
|
||||||
uint32_t dataLength = outputBuffer->size() - 4;
|
// of the sequence parameter set at the beginning.
|
||||||
|
outPtr += 4;
|
||||||
|
dataLength -= 4;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t type;
|
int32_t type;
|
||||||
AVCEnc_Status encoderStatus = AVCENC_SUCCESS;
|
AVCEnc_Status encoderStatus = AVCENC_SUCCESS;
|
||||||
@@ -358,7 +363,7 @@ status_t AVCEncoder::read(
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case AVC_NALTYPE_SPS:
|
case AVC_NALTYPE_SPS:
|
||||||
++mNumInputFrames;
|
++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);
|
outputBuffer->set_range(0, dataLength + 4);
|
||||||
outPtr += (dataLength + 4); // 4 bytes for next start code
|
outPtr += (dataLength + 4); // 4 bytes for next start code
|
||||||
dataLength = outputBuffer->size() -
|
dataLength = outputBuffer->size() -
|
||||||
|
|||||||
Reference in New Issue
Block a user