Changeset 285985 in webkit
- Timestamp:
- Nov 17, 2021 11:53:25 PM (8 months ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r285984 r285985 1 2021-11-17 Youenn Fablet <youenn@apple.com> 2 3 Audio Rate Gets Messed up With Safari WebRTC and Bluetooth Switching 4 https://bugs.webkit.org/show_bug.cgi?id=232822 5 <rdar://problem/85418545> 6 7 Reviewed by Eric Carlson. 8 9 We usually create the unit, start the unit and stop the unit. 10 After that cycle, if we restart the unit, we expect the configuration to stay the same in WebProcess. 11 But, in LocalAudioMediaStreamTrackRendererInternalUnit::stop, we were disposing the audio unit and recreating it if necesary in LocalAudioMediaStreamTrackRendererInternalUnit::start. 12 If the sample rate changed, the new audio unit would use the new sample rate while WebProcess will use the old sample rate. 13 To prevent this, we now always reuse the same description to initialize the audio unit. 14 15 Manually tested. 16 17 * platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.cpp: 18 (WebCore::LocalAudioMediaStreamTrackRendererInternalUnit::createAudioUnitIfNeeded): 19 1 20 2021-11-17 Youenn Fablet <youenn@apple.com> 2 21 -
trunk/Source/WebCore/platform/mediastream/cocoa/AudioMediaStreamTrackRendererInternalUnit.cpp
r285023 r285985 163 163 return; 164 164 165 CAAudioStreamDescription outputDescription;166 165 AudioComponentInstance remoteIOUnit { nullptr }; 167 166 … … 212 211 } 213 212 214 UInt32 size = sizeof(outputDescription.streamDescription()); 215 error = PAL::AudioUnitGetProperty(remoteIOUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &outputDescription.streamDescription(), &size); 216 if (error) { 217 RELEASE_LOG_ERROR(WebRTC, "AudioMediaStreamTrackRendererInternalUnit::createAudioUnit unable to get input stream format, error = %d", error); 218 return; 219 } 220 221 outputDescription.streamDescription().mSampleRate = AudioSession::sharedSession().sampleRate(); 222 223 error = PAL::AudioUnitSetProperty(remoteIOUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &outputDescription.streamDescription(), sizeof(outputDescription.streamDescription())); 213 if (!m_outputDescription) { 214 CAAudioStreamDescription outputDescription; 215 UInt32 size = sizeof(outputDescription.streamDescription()); 216 error = PAL::AudioUnitGetProperty(remoteIOUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &outputDescription.streamDescription(), &size); 217 if (error) { 218 RELEASE_LOG_ERROR(WebRTC, "AudioMediaStreamTrackRendererInternalUnit::createAudioUnit unable to get input stream format, error = %d", error); 219 return; 220 } 221 222 outputDescription.streamDescription().mSampleRate = AudioSession::sharedSession().sampleRate(); 223 m_outputDescription = makeUnique<CAAudioStreamDescription>(outputDescription); 224 } 225 error = PAL::AudioUnitSetProperty(remoteIOUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &m_outputDescription->streamDescription(), sizeof(m_outputDescription->streamDescription())); 224 226 if (error) { 225 227 RELEASE_LOG_ERROR(WebRTC, "AudioMediaStreamTrackRendererInternalUnit::createAudioUnit unable to set input stream format, error = %d", error); … … 233 235 } 234 236 235 m_outputDescription = makeUnique<CAAudioStreamDescription>(outputDescription);236 237 m_remoteIOUnit = remoteIOUnit; 237 238 }
Note: See TracChangeset
for help on using the changeset viewer.