If camera source uses the metadata, we must use HW encoder
Software video encoders are not able to deal with non-YUV metadata in the video buffer sent from camera bug - 3242213 Change-Id: I97361ed88b2a687190e5129459011afff7f32c2d
This commit is contained in:
@@ -1164,8 +1164,11 @@ status_t StagefrightRecorder::setupVideoEncoder(
|
||||
CHECK_EQ(client.connect(), OK);
|
||||
|
||||
// Use software codec for time lapse
|
||||
uint32_t encoder_flags = (mCaptureTimeLapse) ? OMXCodec::kPreferSoftwareCodecs : 0;
|
||||
if (mIsMetaDataStoredInVideoBuffers) {
|
||||
uint32_t encoder_flags = 0;
|
||||
if (mCaptureTimeLapse) {
|
||||
encoder_flags |= OMXCodec::kPreferSoftwareCodecs;
|
||||
} else if (mIsMetaDataStoredInVideoBuffers) {
|
||||
encoder_flags |= OMXCodec::kHardwareCodecsOnly;
|
||||
encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers;
|
||||
}
|
||||
sp<MediaSource> encoder = OMXCodec::Create(
|
||||
@@ -1173,6 +1176,11 @@ status_t StagefrightRecorder::setupVideoEncoder(
|
||||
true /* createEncoder */, cameraSource,
|
||||
NULL, encoder_flags);
|
||||
if (encoder == NULL) {
|
||||
LOGW("Failed to create the encoder");
|
||||
// When the encoder fails to be created, we need
|
||||
// release the camera source due to the camera's lock
|
||||
// and unlock mechanism.
|
||||
cameraSource->stop();
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ AVCEncoder::AVCEncoder(
|
||||
mInputFrameData(NULL),
|
||||
mGroup(NULL) {
|
||||
|
||||
LOGV("Construct software AVCEncoder");
|
||||
LOGI("Construct software AVCEncoder");
|
||||
|
||||
mHandle = new tagAVCHandle;
|
||||
memset(mHandle, 0, sizeof(tagAVCHandle));
|
||||
|
||||
@@ -178,7 +178,7 @@ M4vH263Encoder::M4vH263Encoder(
|
||||
mInputFrameData(NULL),
|
||||
mGroup(NULL) {
|
||||
|
||||
LOGV("Construct software M4vH263Encoder");
|
||||
LOGI("Construct software M4vH263Encoder");
|
||||
|
||||
mHandle = new tagvideoEncControls;
|
||||
memset(mHandle, 0, sizeof(tagvideoEncControls));
|
||||
|
||||
Reference in New Issue
Block a user