Closed Bug 1065957 Opened 10 years ago Closed 10 years ago

[B2G] Correct photo orientation

Categories

(Core :: Audio/Video, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: ayang, Assigned: ayang)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 2 obsolete files)

Use camera control parameter CAMERA_PARAM_PICTURE_ROTATION to correct the photo orientation.
OS: Mac OS X → Gonk (Firefox OS)
Hardware: x86 → ARM
Attached patch b2g_photo_orientation_change (obsolete) — Splinter Review
Attachment #8489227 - Flags: feedback?(rlin)
Attachment #8489227 - Flags: feedback?(jolin)
Comment on attachment 8489227 [details] [diff] [review]
b2g_photo_orientation_change

Review of attachment 8489227 [details] [diff] [review]:
-----------------------------------------------------------------

Always set rotation value before |TakePicture()| seems simpler to me. But overall this looks fine.

::: content/media/webrtc/MediaEngineWebRTC.h
@@ +100,5 @@
>      : mCameraControl(nullptr)
>      , mCallbackMonitor("WebRTCCamera.CallbackMonitor")
>      , mRotation(0)
>      , mBackCamera(false)
> +    , mOrientationChanged(true)

Better to explain why this is true by default. To ensure that camera rotation value will be set according to the screen orientation when gUM is called?

@@ +203,5 @@
>    nsresult TakePhoto(PhotoCallback* aCallback) MOZ_OVERRIDE;
>  
> +  // It sets the correct photo orientation via camera parameter according to
> +  // current screen orientation.
> +  nsresult PhotoOrientationUpdate();

Start method name with a verb: UpdatePhotoOrientation().

::: content/media/webrtc/MediaEngineWebRTCVideo.cpp
@@ +799,5 @@
>           mRotation, mCaptureIndex, mBackCamera, mCameraAngle));
>    }
>  #endif
> +
> +  mOrientationChanged = true;

Doesn't this need to be added before |#endif|?
Attachment #8489227 - Flags: feedback?(jolin) → feedback+
Comment on attachment 8489227 [details] [diff] [review]
b2g_photo_orientation_change

Review of attachment 8489227 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/media/webrtc/MediaEngineWebRTC.h
@@ +100,5 @@
>      : mCameraControl(nullptr)
>      , mCallbackMonitor("WebRTCCamera.CallbackMonitor")
>      , mRotation(0)
>      , mBackCamera(false)
> +    , mOrientationChanged(true)

+1, maybe set this during the StartImpl?

::: content/media/webrtc/MediaEngineWebRTCVideo.cpp
@@ +1088,5 @@
> +
> +  hal::ScreenConfiguration config;
> +  hal::GetCurrentScreenConfiguration(&config);
> +
> +  // The rotation angle is clockwise.

Does this calculation apply to other devices? Maybe have a try on n4 or n5 or others chip vender's devices.
Attachment #8489227 - Flags: feedback?(rlin) → feedback+
Attached patch b2g_photo_orientation_change (obsolete) — Splinter Review
Attachment #8489227 - Attachment is obsolete: true
Attachment #8489264 - Flags: review?(roc)
Comment on attachment 8489264 [details] [diff] [review]
b2g_photo_orientation_change

Review of attachment 8489264 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/media/webrtc/MediaEngineWebRTCVideo.cpp
@@ +1110,5 @@
> +  orientation = (mBackCamera ? orientation : (-orientation));
> +
> +  ICameraControlParameterSetAutoEnter batch(mCameraControl);
> +  // It changes the orientation value in EXIF information only.
> +  mCameraControl->Set(CAMERA_PARAM_PICTURE_ROTATION, orientation);

We don't honor EXIF orientation data by default (for good reasons). But I guess that's OK here.
Attachment #8489264 - Flags: review?(roc) → review+
Thanks for review.

Rebase.

Try result.
https://tbpl.mozilla.org/?tree=Try&rev=35d23e574367
Attachment #8489264 - Attachment is obsolete: true
Attachment #8490643 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/de7c7bbb5679
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: