Bug 990761 - Handle HDR sending us more than one picture. r=dhylands, a=1.4+
authorMike Habicher <mikeh@mozilla.com>
Wed, 16 Apr 2014 21:46:36 -0400
changeset 185693 ea3724cf62eaee2c4aca5f33df5e0d300b2984f9
parent 185692 df67d32e6282846029b8ff39891786d544a22f1b
child 185694 5fe425b4b351a7da206c91d741a042a9abe35de8
push id5736
push userryanvm@gmail.com
push dateThu, 17 Apr 2014 14:41:46 +0000
treeherdermozilla-aurora@ea3724cf62ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdhylands, 1
bugs990761
milestone30.0a2
Bug 990761 - Handle HDR sending us more than one picture. r=dhylands, a=1.4+
dom/camera/GonkCameraControl.cpp
dom/camera/GonkCameraControl.h
dom/camera/GonkCameraParameters.cpp
dom/camera/GonkCameraParameters.h
dom/camera/ICameraControl.h
--- a/dom/camera/GonkCameraControl.cpp
+++ b/dom/camera/GonkCameraControl.cpp
@@ -131,16 +131,18 @@ nsGonkCameraControl::Initialize()
 
   DOM_CAMERA_LOGI("Initializing camera %d (this=%p, mCameraHw=%p)\n", mCameraId, this, mCameraHw.get());
 
   // Initialize our camera configuration database.
   PullParametersImpl();
 
   // Set preferred preview frame format.
   mParams.Set(CAMERA_PARAM_PREVIEWFORMAT, NS_LITERAL_STRING("yuv420sp"));
+  // Turn off any normal pictures returned by the HDR scene mode
+  mParams.Set(CAMERA_PARAM_SCENEMODE_HDR_RETURNNORMALPICTURE, false);
   PushParametersImpl();
 
   // Grab any other settings we'll need later.
   mParams.Get(CAMERA_PARAM_PICTURE_FILEFORMAT, mFileFormat);
   mParams.Get(CAMERA_PARAM_THUMBNAILSIZE, mLastThumbnailSize);
 
   // The emulator's camera returns -1 for these values; bump them up to 0
   int areas;
--- a/dom/camera/GonkCameraControl.h
+++ b/dom/camera/GonkCameraControl.h
@@ -131,17 +131,16 @@ protected:
 
   android::sp<android::GonkCameraHardware> mCameraHw;
 
   Size                      mLastPictureSize;
   Size                      mLastThumbnailSize;
   Size                      mLastRecorderSize;
   uint32_t                  mPreviewFps;
   bool                      mResumePreviewAfterTakingPicture;
-
   Atomic<uint32_t>          mDeferConfigUpdate;
   GonkCameraParameters      mParams;
 
   nsRefPtr<mozilla::layers::ImageContainer> mImageContainer;
 
   android::MediaProfiles*   mMediaProfiles;
   nsRefPtr<android::GonkRecorder> mRecorder;
 
--- a/dom/camera/GonkCameraParameters.cpp
+++ b/dom/camera/GonkCameraParameters.cpp
@@ -76,16 +76,20 @@ GonkCameraParameters::Parameters::GetTex
       // See bug 832494.
       return "exif-datetime";
     case CAMERA_PARAM_VIDEOSIZE:
       return KEY_VIDEO_SIZE;
     case CAMERA_PARAM_ISOMODE:
       // Not every platform defines KEY_ISO_MODE;
       // for those that don't, we use the raw string key.
       return "iso";
+    case CAMERA_PARAM_SCENEMODE_HDR_RETURNNORMALPICTURE:
+      // Not every platform defines KEY_QC_HDR_NEED_1X;
+      // for those that don't, we use the raw string key.
+      return "hdr-need-1x";
 
     case CAMERA_PARAM_SUPPORTED_PREVIEWSIZES:
       return KEY_SUPPORTED_PREVIEW_SIZES;
     case CAMERA_PARAM_SUPPORTED_PICTURESIZES:
       return KEY_SUPPORTED_PICTURE_SIZES;
     case CAMERA_PARAM_SUPPORTED_VIDEOSIZES:
       return KEY_SUPPORTED_VIDEO_SIZES;
     case CAMERA_PARAM_SUPPORTED_PICTUREFORMATS:
@@ -678,16 +682,29 @@ GonkCameraParameters::GetTranslated(uint
   if (val < 0) {
     return NS_ERROR_FAILURE;
   }
 
   aValue = val;
   return NS_OK;
 }
 
+// Handle bools
+nsresult
+GonkCameraParameters::SetTranslated(uint32_t aKey, const bool& aValue)
+{
+  return SetImpl(aKey, aValue);
+}
+
+nsresult
+GonkCameraParameters::GetTranslated(uint32_t aKey, bool& aValue)
+{
+  return GetImpl(aKey, aValue);
+}
+
 nsresult
 ParseItem(const char* aStart, const char* aEnd, ICameraControl::Size* aItem)
 {
   if (sscanf(aStart, "%ux%u", &aItem->width, &aItem->height) == 2) {
     return NS_OK;
   }
 
   DOM_CAMERA_LOGE("Size tuple has bad format: '%s'\n", __func__, __LINE__, aStart);
--- a/dom/camera/GonkCameraParameters.h
+++ b/dom/camera/GonkCameraParameters.h
@@ -98,23 +98,28 @@ protected:
   nsTArray<nsString> mIsoModes;
 
   // This subclass of android::CameraParameters just gives
   // all of the AOSP getters and setters the same signature.
   class Parameters : public android::CameraParameters
   {
   public:
     using android::CameraParameters::set;
+    using android::CameraParameters::get;
+    using android::CameraParameters::TRUE;
+    using android::CameraParameters::FALSE;
 
     void set(const char* aKey, float aValue)      { setFloat(aKey, aValue); }
     void set(const char* aKey, double aValue)     { setFloat(aKey, aValue); }
+    void set(const char* aKey, bool aValue)       { set(aKey, aValue ? TRUE : FALSE); }
     void get(const char* aKey, float& aRet)       { aRet = getFloat(aKey); }
     void get(const char* aKey, double& aRet)      { aRet = getFloat(aKey); }
-    void get(const char* aKey, const char*& aRet) { aRet = android::CameraParameters::get(aKey); }
+    void get(const char* aKey, const char*& aRet) { aRet = get(aKey); }
     void get(const char* aKey, int& aRet)         { aRet = getInt(aKey); }
+    void get(const char* aKey, bool& aRet)        { aRet = strcmp(get(aKey), FALSE); }
 
     static const char* GetTextKey(uint32_t aKey);
   };
 
   Parameters mParams;
 
   // The *Impl() templates handle converting the parameter keys from
   // their enum values to string types, if necessary. These are the
@@ -168,16 +173,18 @@ protected:
   nsresult SetTranslated(uint32_t aKey, const int64_t& aValue);
   nsresult GetTranslated(uint32_t aKey, int64_t& aValue);
   nsresult SetTranslated(uint32_t aKey, const double& aValue);
   nsresult GetTranslated(uint32_t aKey, double& aValue);
   nsresult SetTranslated(uint32_t aKey, const int& aValue);
   nsresult GetTranslated(uint32_t aKey, int& aValue);
   nsresult SetTranslated(uint32_t aKey, const uint32_t& aValue);
   nsresult GetTranslated(uint32_t aKey, uint32_t& aValue);
+  nsresult SetTranslated(uint32_t aKey, const bool& aValue);
+  nsresult GetTranslated(uint32_t aKey, bool& aValue);
   nsresult GetTranslated(uint32_t aKey, nsTArray<nsString>& aValues);
   nsresult GetTranslated(uint32_t aKey, nsTArray<double>& aValues);
 
   template<class T> nsresult GetListAsArray(uint32_t aKey, nsTArray<T>& aArray);
   nsresult MapIsoToGonk(const nsAString& aIso, nsACString& aIsoOut);
   nsresult MapIsoFromGonk(const char* aIso, nsAString& aIsoOut);
 
   nsresult Initialize();
--- a/dom/camera/ICameraControl.h
+++ b/dom/camera/ICameraControl.h
@@ -46,16 +46,17 @@ enum {
   CAMERA_PARAM_FOCUSDISTANCEOPTIMUM,
   CAMERA_PARAM_FOCUSDISTANCEFAR,
   CAMERA_PARAM_EXPOSURECOMPENSATION,
   CAMERA_PARAM_PICTURESIZE,
   CAMERA_PARAM_THUMBNAILSIZE,
   CAMERA_PARAM_THUMBNAILQUALITY,
   CAMERA_PARAM_SENSORANGLE,
   CAMERA_PARAM_ISOMODE,
+  CAMERA_PARAM_SCENEMODE_HDR_RETURNNORMALPICTURE,
 
   // supported features
   CAMERA_PARAM_SUPPORTED_PREVIEWSIZES,
   CAMERA_PARAM_SUPPORTED_PICTURESIZES,
   CAMERA_PARAM_SUPPORTED_VIDEOSIZES,
   CAMERA_PARAM_SUPPORTED_PICTUREFORMATS,
   CAMERA_PARAM_SUPPORTED_WHITEBALANCES,
   CAMERA_PARAM_SUPPORTED_SCENEMODES,