Bug 810440 - Add missing rotation parameter to SetupRecording function call, drop default parameter values. r=daleharvey
authorMike Habicher <mikeh@mozilla.com>
Fri, 09 Nov 2012 20:32:10 -0500
changeset 112908 3b367d7be35f505c2cc9886582523db003e9045b
parent 112907 590963fb0a3dc2981f1f43c02d6789a2489e9535
child 112909 bc88f16024687b689538c48e4b6941c1f80604ef
push id23840
push userryanvm@gmail.com
push dateSat, 10 Nov 2012 12:26:58 +0000
treeherdermozilla-central@ea5c4c1b0edf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaleharvey
bugs810440
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 810440 - Add missing rotation parameter to SetupRecording function call, drop default parameter values. r=daleharvey
dom/camera/GonkCameraControl.cpp
dom/camera/GonkCameraControl.h
--- a/dom/camera/GonkCameraControl.cpp
+++ b/dom/camera/GonkCameraControl.cpp
@@ -846,17 +846,17 @@ nsGonkCameraControl::StartRecordingImpl(
   DOM_CAMERA_LOGI("Video filename is '%s'\n", nativeFilename.get());
 
   ScopedClose fd(open(nativeFilename.get(), O_RDWR | O_CREAT, 0644));
   if (fd < 0) {
     DOM_CAMERA_LOGE("Couldn't create file '%s': (%d) %s\n", nativeFilename.get(), errno, strerror(errno));
     return NS_ERROR_FAILURE;
   }
 
-  nsresult rv = SetupRecording(fd, aStartRecording->mOptions.maxFileSizeBytes, aStartRecording->mOptions.maxVideoLengthMs);
+  nsresult rv = SetupRecording(fd, aStartRecording->mOptions.rotation, aStartRecording->mOptions.maxFileSizeBytes, aStartRecording->mOptions.maxVideoLengthMs);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (mRecorder->start() != OK) {
     DOM_CAMERA_LOGE("mRecorder->start() failed\n");
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
@@ -1201,16 +1201,20 @@ nsGonkCameraControl::SetupRecording(int 
 
   // adjust rotation by camera sensor offset
   int r = aRotation;
   r += GonkCameraHardware::GetSensorOrientation(mHwHandle, GonkCameraHardware::RAW_SENSOR_ORIENTATION);
   r %= 360;
   r += 45;
   r /= 90;
   r *= 90;
+  if (r < 0) {
+    // the video recorder only supports positive rotations
+    r += 360;
+  }
   DOM_CAMERA_LOGI("setting video rotation to %d degrees (mapped from %d)\n", r, aRotation);
   snprintf(buffer, SIZE, "video-param-rotation-angle-degrees=%d", r);
   CHECK_SETARG(mRecorder->setParameters(String8(buffer)));
 
   CHECK_SETARG(mRecorder->setListener(new GonkRecorderListener(this)));
 
   // recording API needs file descriptor of output file
   CHECK_SETARG(mRecorder->setOutputFile(aFd, 0, 0));
--- a/dom/camera/GonkCameraControl.h
+++ b/dom/camera/GonkCameraControl.h
@@ -51,17 +51,17 @@ public:
   void SetParameter(const char* aKey, const char* aValue);
   void SetParameter(uint32_t aKey, const char* aValue);
   void SetParameter(uint32_t aKey, double aValue);
   void SetParameter(uint32_t aKey, const nsTArray<dom::CameraRegion>& aRegions);
   void SetParameter(uint32_t aKey, int aValue);
   nsresult GetVideoSizes(nsTArray<CameraSize>& aVideoSizes);
   nsresult PushParameters();
 
-  nsresult SetupRecording(int aFd, int aRotation = 0, int64_t aMaxFileSizeBytes = -1, int64_t aMaxVideoLengthMs = -1);
+  nsresult SetupRecording(int aFd, int aRotation, int64_t aMaxFileSizeBytes, int64_t aMaxVideoLengthMs);
   nsresult SetupVideoMode(const nsAString& aProfile);
 
   void AutoFocusComplete(bool aSuccess);
   void TakePictureComplete(uint8_t* aData, uint32_t aLength);
   void HandleRecorderEvent(int msg, int ext1, int ext2);
 
 protected:
   ~nsGonkCameraControl();