RESOLVED FIXED 235397
Reconfiguring the CoreAudioSharedUnit should take into account that there is a speaker sample producer
https://bugs.webkit.org/show_bug.cgi?id=235397
Summary Reconfiguring the CoreAudioSharedUnit should take into account that there is ...
youenn fablet
Reported 2022-01-20 03:03:40 PST
Reconfiguring the CoreAudioSharedUnit should take into account that there is a speaker sample producer
Attachments
Patch (2.41 KB, patch)
2022-01-20 03:06 PST, youenn fablet
no flags
Patch for landing (2.42 KB, patch)
2022-01-20 09:03 PST, youenn fablet
no flags
Patch (4.13 KB, patch)
2022-01-20 23:15 PST, youenn fablet
no flags
Radar WebKit Bug Importer
Comment 1 2022-01-20 03:06:03 PST
youenn fablet
Comment 2 2022-01-20 03:06:19 PST
Eric Carlson
Comment 3 2022-01-20 08:24:35 PST
Comment on attachment 449561 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=449561&action=review > Source/WebCore/ChangeLog:11 > + When switching of microphone, we might switch of speaker as well which requires reconfiguring the audio unit. s/of/off/
youenn fablet
Comment 4 2022-01-20 09:03:47 PST
Created attachment 449586 [details] Patch for landing
Geoffrey Garen
Comment 5 2022-01-20 09:35:27 PST
Comment on attachment 449586 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=449586&action=review > Source/WebCore/ChangeLog:13 > + To prevent this, we set the producer temporarily, stop the audio unit, then set back the producer. Which function are we trying to influence by setting m_speakerSamplesProducer to null? I wonder if it would improve encapsulation to use a separate boolean "m_isReconfiguringAudioUnit", and have the target function check that boolean explicitly. When we set m_speakerSamplesProducer to null temporarily, we potentially change the behavior of every function in the class. If we used a separate boolean, we would only change the behavior of functions that explicitly adopted it. > Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp:459 > + speakerSamplesProducer = m_speakerSamplesProducer; > + m_speakerSamplesProducer = nullptr; This can be written as "speakerSamplesProducer = std::exchange(m_speakerSamplesProducer, nullptr)". > Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp:464 > + m_speakerSamplesProducer = speakerSamplesProducer; Might also be nice to std::exchange with nullptr here, to guarantee that code below cannot use speakerSamplesProducer erroneously.
EWS
Comment 6 2022-01-20 10:08:00 PST
Committed r288302 (246220@main): <https://commits.webkit.org/246220@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 449586 [details].
youenn fablet
Comment 7 2022-01-20 23:01:55 PST
(In reply to Geoffrey Garen from comment #5) > Comment on attachment 449586 [details] > Patch for landing > > View in context: > https://bugs.webkit.org/attachment.cgi?id=449586&action=review > > > Source/WebCore/ChangeLog:13 > > + To prevent this, we set the producer temporarily, stop the audio unit, then set back the producer. > > Which function are we trying to influence by setting > m_speakerSamplesProducer to null? We are trying to influence CoreAudioSharedUnit::provideSpeakerData. > I wonder if it would improve encapsulation to use a separate boolean > "m_isReconfiguringAudioUnit", and have the target function check that > boolean explicitly. When we set m_speakerSamplesProducer to null > temporarily, we potentially change the behavior of every function in the > class. If we used a separate boolean, we would only change the behavior of > functions that explicitly adopted it. Right, this should do the trick as well. I'll have a try. > > Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp:459 > > + speakerSamplesProducer = m_speakerSamplesProducer; > > + m_speakerSamplesProducer = nullptr; > > This can be written as "speakerSamplesProducer = > std::exchange(m_speakerSamplesProducer, nullptr)". > > > Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp:464 > > + m_speakerSamplesProducer = speakerSamplesProducer; > > Might also be nice to std::exchange with nullptr here, to guarantee that > code below cannot use speakerSamplesProducer erroneously.
youenn fablet
Comment 8 2022-01-20 23:15:02 PST
Reopening to attach new patch.
youenn fablet
Comment 9 2022-01-20 23:15:06 PST
youenn fablet
Comment 10 2022-01-24 07:33:25 PST
Comment on attachment 449640 [details] Patch bot failure unrelated.
EWS
Comment 11 2022-01-24 07:38:30 PST
Committed r288439 (246328@main): <https://commits.webkit.org/246328@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 449640 [details].
Note You need to log in before you can comment on or make changes to this bug.