RESOLVED FIXED168027
Configure MockRealtimeAudioSourceMac to generate stereo audio
https://bugs.webkit.org/show_bug.cgi?id=168027
Summary Configure MockRealtimeAudioSourceMac to generate stereo audio
Jer Noble
Reported 2017-02-08 16:40:23 PST
Configure MockRealtimeAudioSourceMac to generate stereo audio
Attachments
Patch (50.04 KB, patch)
2017-02-08 17:54 PST, Jer Noble
eric.carlson: review+
Patch for landing (50.20 KB, patch)
2017-02-08 21:36 PST, Jer Noble
no flags
Patch for landing (50.41 KB, patch)
2017-02-08 21:38 PST, Jer Noble
no flags
Jer Noble
Comment 1 2017-02-08 17:54:02 PST
Jer Noble
Comment 2 2017-02-08 17:56:15 PST
Eric Carlson
Comment 3 2017-02-08 18:25:42 PST
Comment on attachment 300992 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=300992&action=review > Source/WebCore/platform/audio/mac/AudioSampleBufferList.cpp:53 > + m_bufferList = std::make_unique<WebAudioBufferList>(format, m_maxBufferSizePerChannel); This is unnecessary, te call to reset() below will do it. > Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm:207 > + OSStatus err = CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(sampleBuffer, nullptr, m_list->list(), m_listBufferSize, kCFAllocatorSystemDefault, kCFAllocatorSystemDefault, kCMSampleBufferFlag_AudioBufferList_Assure16ByteAlignment, &buffer); Isn't this already done by the call to WebAudioBufferList:: WebAudioBufferList(const CAAudioStreamDescription&, CMSampleBufferRef)?
Jer Noble
Comment 4 2017-02-08 21:27:39 PST
Comment on attachment 300992 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=300992&action=review >> Source/WebCore/platform/audio/mac/AudioSampleBufferList.cpp:53 >> + m_bufferList = std::make_unique<WebAudioBufferList>(format, m_maxBufferSizePerChannel); > > This is unnecessary, te call to reset() below will do it. Indeed! >> Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm:207 >> + OSStatus err = CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(sampleBuffer, nullptr, m_list->list(), m_listBufferSize, kCFAllocatorSystemDefault, kCFAllocatorSystemDefault, kCMSampleBufferFlag_AudioBufferList_Assure16ByteAlignment, &buffer); > > Isn't this already done by the call to WebAudioBufferList:: WebAudioBufferList(const CAAudioStreamDescription&, CMSampleBufferRef)? You're right! > Source/WebCore/platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:143 > m_streamFormat.mSampleRate = m_sampleRate; > m_streamFormat.mFormatID = kAudioFormatLinearPCM; > - m_streamFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked; > - m_streamFormat.mBytesPerPacket = bytesPerFloat * channelCount; > + m_streamFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kAudioFormatFlagIsNonInterleaved; > + m_streamFormat.mBytesPerPacket = bytesPerFloat; > m_streamFormat.mFramesPerPacket = 1; > - m_streamFormat.mBytesPerFrame = bytesPerFloat * channelCount; > + m_streamFormat.mBytesPerFrame = bytesPerFloat; > m_streamFormat.mChannelsPerFrame = channelCount; > m_streamFormat.mBitsPerChannel = bitsPerByte * bytesPerFloat; It also looks like this can all be replaced by a call to FillOutASBDForLPCM(). Will change before landing.
Jer Noble
Comment 5 2017-02-08 21:36:06 PST
Created attachment 301014 [details] Patch for landing
Jer Noble
Comment 6 2017-02-08 21:38:40 PST
Created attachment 301016 [details] Patch for landing
youenn fablet
Comment 7 2017-02-09 07:59:25 PST
Comment on attachment 301016 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=301016&action=review > Source/WebCore/platform/mediastream/RealtimeMediaSource.h:113 > + void audioSamplesAvailable(const MediaTime&, PlatformAudioData&, const AudioStreamDescription&, size_t); It is not very clear to me why this takes a PlatformAudioData&. I would expect either a const PlatformAudioData& or a PlatformAudioData&& as parameter. Also, is the numberOfFrames a parameter on its own, or should it be part of PlatformAudioData?
WebKit Commit Bot
Comment 8 2017-02-09 08:34:39 PST
Comment on attachment 301016 [details] Patch for landing Clearing flags on attachment: 301016 Committed r211959: <http://trac.webkit.org/changeset/211959>
Jer Noble
Comment 9 2017-02-09 08:39:04 PST
(In reply to comment #7) > Comment on attachment 301016 [details] > Patch for landing > > View in context: > https://bugs.webkit.org/attachment.cgi?id=301016&action=review > > > Source/WebCore/platform/mediastream/RealtimeMediaSource.h:113 > > + void audioSamplesAvailable(const MediaTime&, PlatformAudioData&, const AudioStreamDescription&, size_t); > > It is not very clear to me why this takes a PlatformAudioData&. > I would expect either a const PlatformAudioData& or a PlatformAudioData&& as > parameter. It's not a && because the calling class retains ownership of the object. It's not const because we'd have to cast away the constness when accessing the wrapped ABL. > Also, is the numberOfFrames a parameter on its own, or should it be part of > PlatformAudioData? The PlatformAudioData has a capacity, but not a numberOfFrames. I don't think we want to tie together the concept of "please copy this number of frames out of this audio data" with the audio data structure itself.
Jer Noble
Comment 10 2017-02-09 08:49:50 PST
(In reply to comment #9) > It's not const because we'd have to cast away the constness when accessing > the wrapped ABL. So it looks like you can make this entire path const-correct, but it's a significant code change, deserving of its own patch.
Jer Noble
Comment 11 2017-02-09 09:05:12 PST
(In reply to comment #10) > (In reply to comment #9) > > It's not const because we'd have to cast away the constness when accessing > > the wrapped ABL. > > So it looks like you can make this entire path const-correct, but it's a > significant code change, deserving of its own patch. See <https://bugs.webkit.org/show_bug.cgi?id=168051>
Ahmad Saleem
Comment 12 2022-10-26 03:44:33 PDT
It seems this landed: https://github.com/WebKit/WebKit/commit/c71329a506449e928ab40cc4a0496260f6881336 and didn't backed out and follow-up bug also corrected the other bits. Marking this as "RESOLVED FIXED".
Note You need to log in before you can comment on or make changes to this bug.