Title: [268091] branches/safari-610-branch/Source/WebCore
- Revision
- 268091
- Author
- [email protected]
- Date
- 2020-10-06 17:09:17 -0700 (Tue, 06 Oct 2020)
Log Message
Cherry-pick r267828. rdar://problem/70023908
[iOS] MediaRecorder incorrect screen orientation handling
https://bugs.webkit.org/show_bug.cgi?id=198912
<rdar://problem/51802521>
Reviewed by Eric Carlson.
We were setting the transform to the writer input too soon.
Buffer the transform when receiving the first frame and set it at creation of the writer input.
Covered by http/wpt/mediarecorder/video-rotation.html now actually passing.
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
* platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
(WebCore::MediaRecorderPrivateWriter::startAssetWriter):
(WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-610-branch/Source/WebCore/ChangeLog (268090 => 268091)
--- branches/safari-610-branch/Source/WebCore/ChangeLog 2020-10-07 00:09:14 UTC (rev 268090)
+++ branches/safari-610-branch/Source/WebCore/ChangeLog 2020-10-07 00:09:17 UTC (rev 268091)
@@ -1,5 +1,46 @@
2020-10-06 Alan Coon <[email protected]>
+ Cherry-pick r267828. rdar://problem/70023908
+
+ [iOS] MediaRecorder incorrect screen orientation handling
+ https://bugs.webkit.org/show_bug.cgi?id=198912
+ <rdar://problem/51802521>
+
+ Reviewed by Eric Carlson.
+
+ We were setting the transform to the writer input too soon.
+ Buffer the transform when receiving the first frame and set it at creation of the writer input.
+
+ Covered by http/wpt/mediarecorder/video-rotation.html now actually passing.
+
+ * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
+ * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
+ (WebCore::MediaRecorderPrivateWriter::startAssetWriter):
+ (WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2020-10-01 Youenn Fablet <[email protected]>
+
+ [iOS] MediaRecorder incorrect screen orientation handling
+ https://bugs.webkit.org/show_bug.cgi?id=198912
+ <rdar://problem/51802521>
+
+ Reviewed by Eric Carlson.
+
+ We were setting the transform to the writer input too soon.
+ Buffer the transform when receiving the first frame and set it at creation of the writer input.
+
+ Covered by http/wpt/mediarecorder/video-rotation.html now actually passing.
+
+ * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
+ * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
+ (WebCore::MediaRecorderPrivateWriter::startAssetWriter):
+ (WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
+
+2020-10-06 Alan Coon <[email protected]>
+
Cherry-pick r267521. rdar://problem/70023915
REGRESSION (iOS/Safari 14): MediaRecorder produces invalid video files
Modified: branches/safari-610-branch/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h (268090 => 268091)
--- branches/safari-610-branch/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h 2020-10-07 00:09:14 UTC (rev 268090)
+++ branches/safari-610-branch/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h 2020-10-07 00:09:17 UTC (rev 268091)
@@ -131,6 +131,7 @@
bool m_isFlushingSamples { false };
bool m_shouldStopAfterFlushingSamples { false };
bool m_firstVideoFrame { false };
+ Optional<CGAffineTransform> m_videoTransform;
CMTime m_firstVideoSampleTime { kCMTimeZero };
CMTime m_currentAudioSampleTime { kCMTimeZero };
};
Modified: branches/safari-610-branch/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm (268090 => 268091)
--- branches/safari-610-branch/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm 2020-10-07 00:09:14 UTC (rev 268090)
+++ branches/safari-610-branch/Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm 2020-10-07 00:09:17 UTC (rev 268091)
@@ -224,6 +224,9 @@
if (m_hasVideo) {
m_videoAssetWriterInput = adoptNS([PAL::allocAVAssetWriterInputInstance() initWithMediaType:AVMediaTypeVideo outputSettings:nil sourceFormatHint:m_videoFormatDescription.get()]);
[m_videoAssetWriterInput setExpectsMediaDataInRealTime:true];
+ if (m_videoTransform)
+ m_videoAssetWriterInput.get().transform = *m_videoTransform;
+
if (![m_writer.get() canAddInput:m_videoAssetWriterInput.get()]) {
RELEASE_LOG_ERROR(MediaStream, "MediaRecorderPrivateWriter::startAssetWriter failed canAddInput for video");
return;
@@ -426,10 +429,9 @@
m_firstVideoFrame = true;
m_firstVideoSampleTime = CMClockGetTime(CMClockGetHostTimeClock());
if (sample.videoRotation() != MediaSample::VideoRotation::None || sample.videoMirrored()) {
- auto videoTransform = CGAffineTransformMakeRotation(static_cast<int>(sample.videoRotation()) * M_PI / 180);
+ m_videoTransform = CGAffineTransformMakeRotation(static_cast<int>(sample.videoRotation()) * M_PI / 180);
if (sample.videoMirrored())
- videoTransform = CGAffineTransformScale(videoTransform, -1, 1);
- m_videoAssetWriterInput.get().transform = videoTransform;
+ m_videoTransform = CGAffineTransformScale(*m_videoTransform, -1, 1);
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes