RESOLVED FIXED 180156
[MediaStream] Clean up audio and video capture factories
https://bugs.webkit.org/show_bug.cgi?id=180156
Summary [MediaStream] Clean up audio and video capture factories
Eric Carlson
Reported 2017-11-29 11:40:44 PST
Clean up audio and video capture factories
Attachments
Proposed patch (27.74 KB, patch)
2017-11-29 12:03 PST, Eric Carlson
no flags
Patch for landing. (33.06 KB, patch)
2017-11-29 14:48 PST, Eric Carlson
no flags
Patch for landing. (31.94 KB, patch)
2017-11-29 16:24 PST, Eric Carlson
no flags
Patch for landing. (32.65 KB, patch)
2017-11-29 18:29 PST, Eric Carlson
no flags
Radar WebKit Bug Importer
Comment 1 2017-11-29 11:42:11 PST
Eric Carlson
Comment 2 2017-11-29 12:03:54 PST
Created attachment 327884 [details] Proposed patch
EWS Watchlist
Comment 3 2017-11-29 12:06:56 PST
Attachment 327884 [details] did not pass style-queue: ERROR: Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.cpp:49: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 4 2017-11-29 12:50:50 PST
Comment on attachment 327884 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=327884&action=review > Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm:137 > + RealtimeMediaSourceCenter::singleton().videoFactory().unsetActiveSource(*this); Maybe we can do without this change (see other lower comments) or find a way to grab the factory that created the source. > Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:-64 > - m_supportedConstraints.setSupportsGroupId(true); We are going from default supportsGroupId being true to being false. Is that what we want? > Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:53 > + void unsetAudioFactory(RealtimeMediaSource::AudioCaptureFactory&) override { m_audioFactoryOverride = nullptr; } should be final. > Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp:97 > + RealtimeMediaSourceCenter::singleton().videoFactory().unsetActiveSource(*this); Should be audioFactory probably. But do we need that change though? Previously, we had a tight coupling between the factory and the source set as active/inactive. Now, we could set an active mock video source to a non-mock video factory if we are switching dynamically the source center audio factory. There might be an issue here although probably restricted to people switching from/to mock while capturing audio? > Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp:125 > + RealtimeMediaSourceCenter::singleton().videoFactory().setActiveSource(*this); audioFactory as well if we need that change.
youenn fablet
Comment 5 2017-11-29 13:32:36 PST
(In reply to youenn fablet from comment #4) > Comment on attachment 327884 [details] > Proposed patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=327884&action=review > > > Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm:137 > > + RealtimeMediaSourceCenter::singleton().videoFactory().unsetActiveSource(*this); If we expose "static VideoCaptureSourceFactoryMac& videoCaptureSourceFactory()" as a static method of RealtimeMediaSourceCenterMac, we could probably write RealtimeMediaSourceCenterMac::videoCaptureSourceFactory().unsetActiveSource(*this);
Eric Carlson
Comment 6 2017-11-29 14:47:54 PST
Comment on attachment 327884 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=327884&action=review >>> Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm:137 >>> + RealtimeMediaSourceCenter::singleton().videoFactory().unsetActiveSource(*this); >> >> Maybe we can do without this change (see other lower comments) or find a way to grab the factory that created the source. > > If we expose "static VideoCaptureSourceFactoryMac& videoCaptureSourceFactory()" as a static method of RealtimeMediaSourceCenterMac, we could probably write RealtimeMediaSourceCenterMac::videoCaptureSourceFactory().unsetActiveSource(*this); Good idea, fixed. >> Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:-64 >> - m_supportedConstraints.setSupportsGroupId(true); > > We are going from default supportsGroupId being true to being false. > Is that what we want? Yes, the we do not support it. >> Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:53 >> + void unsetAudioFactory(RealtimeMediaSource::AudioCaptureFactory&) override { m_audioFactoryOverride = nullptr; } > > should be final. Fixed. >> Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp:97 >> + RealtimeMediaSourceCenter::singleton().videoFactory().unsetActiveSource(*this); > > Should be audioFactory probably. > But do we need that change though? > > Previously, we had a tight coupling between the factory and the source set as active/inactive. > Now, we could set an active mock video source to a non-mock video factory if we are switching dynamically the source center audio factory. > There might be an issue here although probably restricted to people switching from/to mock while capturing audio? Oops, fixed. >> Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp:125 >> + RealtimeMediaSourceCenter::singleton().videoFactory().setActiveSource(*this); > > audioFactory as well if we need that change. Fixed.
Eric Carlson
Comment 7 2017-11-29 14:48:28 PST
Created attachment 327912 [details] Patch for landing.
EWS Watchlist
Comment 8 2017-11-29 14:50:10 PST
Attachment 327912 [details] did not pass style-queue: ERROR: Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.cpp:49: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] ERROR: Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:48: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 2 in 13 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Carlson
Comment 9 2017-11-29 16:24:55 PST
Created attachment 327922 [details] Patch for landing.
EWS Watchlist
Comment 10 2017-11-29 16:26:33 PST
Attachment 327922 [details] did not pass style-queue: ERROR: Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.cpp:49: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] ERROR: Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:48: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 2 in 13 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Carlson
Comment 11 2017-11-29 18:29:09 PST
Created attachment 327943 [details] Patch for landing.
EWS Watchlist
Comment 12 2017-11-29 18:32:04 PST
Attachment 327943 [details] did not pass style-queue: ERROR: Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.cpp:49: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] ERROR: Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:48: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 2 in 13 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 13 2017-11-29 19:36:30 PST
Comment on attachment 327943 [details] Patch for landing. Clearing flags on attachment: 327943 Committed r225313: <https://trac.webkit.org/changeset/225313>
Note You need to log in before you can comment on or make changes to this bug.