RESOLVED FIXED 205645
Apply rotation at source level if WebRTC sink ask so
https://bugs.webkit.org/show_bug.cgi?id=205645
Summary Apply rotation at source level if WebRTC sink ask so
youenn fablet
Reported 2019-12-30 06:41:15 PST
Apply rotation at source level if WebRTC sink ask so. This allows to do rotation in UIProcess/GPUProcess if needed.
Attachments
Patch (23.50 KB, patch)
2019-12-30 06:48 PST, youenn fablet
no flags
Patch (24.43 KB, patch)
2019-12-30 09:08 PST, youenn fablet
no flags
Patch (24.70 KB, patch)
2019-12-30 09:36 PST, youenn fablet
no flags
Patch (25.74 KB, patch)
2019-12-31 01:53 PST, youenn fablet
no flags
Patch (22.74 KB, patch)
2020-03-10 06:34 PDT, youenn fablet
no flags
Patch (23.53 KB, patch)
2020-03-13 00:56 PDT, youenn fablet
no flags
Potential build fix (24.06 KB, patch)
2020-03-16 03:51 PDT, youenn fablet
no flags
Potential build fix (24.07 KB, patch)
2020-03-16 05:34 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2019-12-30 06:48:55 PST
youenn fablet
Comment 2 2019-12-30 09:08:45 PST
Eric Carlson
Comment 3 2019-12-30 09:27:06 PST
Comment on attachment 386538 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=386538&action=review > Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.mm:123 > + IntSize size { (int)CVPixelBufferGetWidth(pixelBuffer) , (int)CVPixelBufferGetHeight(pixelBuffer) }; s/(pixelBuffer) , (int)/(pixelBuffer), (int)/ > Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp:94 > + if (!shouldApplyRotation || shouldApplyRotation == m_areSinksAskingToApplyRotation) > + return; > + > + m_areSinksAskingToApplyRotation = true; > + if (!m_videoSource->source().setShouldApplyRotation(true)) > + m_shouldApplyRotation = true; Don't you want to clear m_areSinksAskingToApplyRotation and unapply rotation to the source if passed shouldApplyRotation==false?
youenn fablet
Comment 4 2019-12-30 09:36:05 PST
youenn fablet
Comment 5 2019-12-30 09:37:26 PST
> > + m_areSinksAskingToApplyRotation = true; > > + if (!m_videoSource->source().setShouldApplyRotation(true)) > > + m_shouldApplyRotation = true; > > Don't you want to clear m_areSinksAskingToApplyRotation and unapply rotation > to the source if passed shouldApplyRotation==false? Not really, for instance if the same track is given to two peer connections one with CVO enabled and the other with CVO disabled. It is simpler to enable rotation at source level and never disable it. In practice, this should happen rarely.
Eric Carlson
Comment 6 2019-12-30 09:48:49 PST
(In reply to youenn fablet from comment #5) > > > + m_areSinksAskingToApplyRotation = true; > > > + if (!m_videoSource->source().setShouldApplyRotation(true)) > > > + m_shouldApplyRotation = true; > > > > Don't you want to clear m_areSinksAskingToApplyRotation and unapply rotation > > to the source if passed shouldApplyRotation==false? > > Not really, for instance if the same track is given to two peer connections > one with CVO enabled and the other with CVO disabled. > It is simpler to enable rotation at source level and never disable it. > In practice, this should happen rarely. Then why have the 'shouldApplyRotation' parameter at all?
youenn fablet
Comment 7 2019-12-31 01:53:36 PST
youenn fablet
Comment 8 2019-12-31 02:16:55 PST
(In reply to Eric Carlson from comment #6) > (In reply to youenn fablet from comment #5) > > > > + m_areSinksAskingToApplyRotation = true; > > > > + if (!m_videoSource->source().setShouldApplyRotation(true)) > > > > + m_shouldApplyRotation = true; > > > > > > Don't you want to clear m_areSinksAskingToApplyRotation and unapply rotation > > > to the source if passed shouldApplyRotation==false? > > > > Not really, for instance if the same track is given to two peer connections > > one with CVO enabled and the other with CVO disabled. > > It is simpler to enable rotation at source level and never disable it. > > In practice, this should happen rarely. > > Then why have the 'shouldApplyRotation' parameter at all? True, I removed it from RealtimeOutgoingVideoSource.
youenn fablet
Comment 9 2020-03-10 06:34:54 PDT
Eric Carlson
Comment 10 2020-03-11 09:35:11 PDT
Comment on attachment 393143 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=393143&action=review > Source/WebCore/ChangeLog:9 > + By default, the method does nothing and RealtimeOyutgoingVideoSource will continue to do the rotation itself. s/RealtimeOyutgoingVideoSource/RealtimeOutgoingVideoSource/ > Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.h:58 > + ImageRotationSessionVT(const RotationProperties&, FloatSize, OSType pixelFormat, IsCGImageCompatible); Nit: "pixelFormat" doesn't seem necessary. > Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.h:72 > + void initialize(const RotationProperties&, FloatSize, OSType pixelFormat, IsCGImageCompatible); Ditto. > Source/WebCore/platform/graphics/cv/ImageRotationSessionVT.mm:101 > CVPixelBufferPoolRef rawPool = nullptr; > if (auto err = CVPixelBufferPoolCreate(kCFAllocatorDefault, nullptr, (__bridge CFDictionaryRef)pixelAttributes, &rawPool); err != noErr) I now this isn't new, but it seems like a bad idea to use a NULL buffer pool if this fails. > Source/WebCore/platform/mediastream/RealtimeMediaSource.h:200 > + virtual bool setShouldApplyRotation(bool /* shouldApplyRotation */) { return false; } Nit: the method name is quite descriptive so the commented out parameter name doesn't seem necessary. > Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:195 > + bool m_shouldApplyRotation { false }; It doesn't look like this is used. > Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp:226 > + bool setShouldApplyRotation(bool /* shouldApplyRotation */) final; Same comment as above.
youenn fablet
Comment 11 2020-03-13 00:56:07 PDT
WebKit Commit Bot
Comment 12 2020-03-13 03:13:18 PDT
Comment on attachment 393464 [details] Patch Clearing flags on attachment: 393464 Committed r258391: <https://trac.webkit.org/changeset/258391>
WebKit Commit Bot
Comment 13 2020-03-13 03:13:20 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 14 2020-03-13 03:14:17 PDT
Ryan Haddad
Comment 15 2020-03-13 13:22:59 PDT
Reverted in https://trac.webkit.org/changeset/258424/webkit because it broke internal builds. Build logs in radar.
youenn fablet
Comment 16 2020-03-16 03:51:54 PDT
Created attachment 393644 [details] Potential build fix
youenn fablet
Comment 17 2020-03-16 05:34:45 PDT
Created attachment 393649 [details] Potential build fix
WebKit Commit Bot
Comment 18 2020-03-16 09:41:19 PDT
Comment on attachment 393649 [details] Potential build fix Clearing flags on attachment: 393649 Committed r258504: <https://trac.webkit.org/changeset/258504>
WebKit Commit Bot
Comment 19 2020-03-16 09:41:21 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.