iOS 12.2 Drawing portrait video to canvas is sideways
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Jun 2019 19:57:46 +0000 (19:57 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Jun 2019 19:57:46 +0000 (19:57 +0000)
commitabfc3cc7fa9d86bed06d9c51991d7c489576a4b0
treed5edda31631c8e71e2991817f713ba30484245c6
parent6b451d376c3a780235ee9fdd0201acfad73af92e
iOS 12.2 Drawing portrait video to canvas is sideways
https://bugs.webkit.org/show_bug.cgi?id=196772
<rdar://problem/49781802>

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/video-orientation-canvas.html

Move rotation code into its own ImageRotationSessionVT class for re-use across
all existing classes with rotation operations. Should slightly increase performance
for painting rotated media files, as the rotation only occurs once per frame, rather
than once per drawing operation.

* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
(WebCore::ImageDecoderAVFObjC::RotationProperties::isIdentity const): Deleted.
* platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
(WebCore::ImageDecoderAVFObjC::readTrackMetadata):
(WebCore::ImageDecoderAVFObjC::storeSampleBuffer):
(WebCore::ImageDecoderAVFObjC::setTrack):
(WebCore::transformToRotationProperties): Deleted.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
* platform/graphics/cv/ImageRotationSessionVT.h: Added.
(WebCore::ImageRotationSessionVT::RotationProperties::isIdentity const):
(WebCore::ImageRotationSessionVT::rotationProperties const):
(WebCore::ImageRotationSessionVT::rotatedSize):
* platform/graphics/cv/ImageRotationSessionVT.mm: Added.
(WebCore::transformToRotationProperties):
(WebCore::ImageRotationSessionVT::ImageRotationSessionVT):
(WebCore::ImageRotationSessionVT::rotate):
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h:
* platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm:
(WebCore::rotationToAngle):
(WebCore::RealtimeOutgoingVideoSourceCocoa::rotatePixelBuffer):
(WebCore::computeRotatedWidthAndHeight): Deleted.

LayoutTests:

* media/content/no-rotation.mp4:
* media/media-source/only-bcp47-language-tags-accepted-as-valid-expected.txt:
* media/video-orientation-canvas-expected.txt: Added.
* media/video-orientation-canvas.html: Added.
* media/video-test.js:
(waitFor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246759 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/media/content/no-rotation.mp4
LayoutTests/media/media-source/only-bcp47-language-tags-accepted-as-valid-expected.txt
LayoutTests/media/video-orientation-canvas-expected.txt [new file with mode: 0644]
LayoutTests/media/video-orientation-canvas.html [new file with mode: 0644]
LayoutTests/media/video-test.js
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.h [new file with mode: 0644]
Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.mm [new file with mode: 0644]
Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp
Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h
Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm