Bug 1171374 - Permit software video codecs with the emulated camera. r=sotaro

This commit is contained in:
Andrew Osmond 2015-06-18 17:12:06 -04:00
parent bcbbf47bda
commit f313a809c9
3 changed files with 18 additions and 1 deletions

View File

@ -53,6 +53,7 @@ GonkCameraHardware::GonkCameraHardware(mozilla::nsGonkCameraControl* aTarget, ui
, mTarget(aTarget)
, mRawSensorOrientation(0)
, mSensorOrientation(0)
, mEmulated(false)
{
DOM_CAMERA_LOGT("%s:%d : this=%p (aTarget=%p)\n", __func__, __LINE__, (void*)this, (void*)aTarget);
}
@ -194,6 +195,11 @@ GonkCameraHardware::Init()
}
DOM_CAMERA_LOGI("Sensor orientation: base=%d, offset=%d, final=%d\n", info.orientation, offset, mSensorOrientation);
if (__system_property_get("ro.kernel.qemu", prop) > 0 && atoi(prop)) {
DOM_CAMERA_LOGI("Using emulated camera\n");
mEmulated = true;
}
// Disable shutter sound in android CameraService because gaia camera app will play it
mCamera->sendCommand(CAMERA_CMD_ENABLE_SHUTTER_SOUND, 0, 0);
@ -322,6 +328,12 @@ GonkCameraHardware::GetSensorOrientation(uint32_t aType)
}
}
bool
GonkCameraHardware::IsEmulated()
{
return mEmulated;
}
int
GonkCameraHardware::AutoFocus()
{

View File

@ -99,6 +99,8 @@ public:
};
virtual int GetSensorOrientation(uint32_t aType = RAW_SENSOR_ORIENTATION);
virtual bool IsEmulated();
/**
* MIN_UNDEQUEUED_BUFFERS has increased to 4 since Android JB. For FFOS, more
* than 3 gralloc buffers are necessary between ImageHost and GonkBufferQueue
@ -140,6 +142,7 @@ protected:
#endif
int mRawSensorOrientation;
int mSensorOrientation;
bool mEmulated;
private:
GonkCameraHardware(const GonkCameraHardware&) = delete;

View File

@ -1272,7 +1272,9 @@ status_t GonkRecorder::setupVideoEncoder(
// CHECK_EQ causes an abort if the given condition fails.
CHECK_EQ(client.connect(), (status_t)OK);
uint32_t encoder_flags = OMXCodec::kHardwareCodecsOnly;
uint32_t encoder_flags = mCameraHw->IsEmulated()
? 0
: OMXCodec::kHardwareCodecsOnly;
if (mIsMetaDataStoredInVideoBuffers) {
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers;