RESOLVED FIXED 167656
[Mac] Update CARingBuffer class
https://bugs.webkit.org/show_bug.cgi?id=167656
Summary [Mac] Update CARingBuffer class
Eric Carlson
Reported 2017-01-31 11:47:20 PST
Update class to be able to copy or mix input, and to allocate storage from the information in a stream description.
Attachments
Proposed patch (6.62 KB, patch)
2017-01-31 12:48 PST, Eric Carlson
no flags
Updated patch, with API test. (45.00 KB, patch)
2017-02-01 15:13 PST, Eric Carlson
no flags
Eric Carlson
Comment 1 2017-01-31 12:48:45 PST
Created attachment 300248 [details] Proposed patch
WebKit Commit Bot
Comment 2 2017-01-31 12:51:16 PST
Attachment 300248 [details] did not pass style-queue: ERROR: Source/WebCore/platform/audio/mac/CARingBuffer.h:58: The parameter name "mode" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 1 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Jer Noble
Comment 3 2017-01-31 14:17:22 PST
Comment on attachment 300248 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=300248&action=review > Source/WebCore/platform/audio/mac/CARingBuffer.cpp:140 > + case CARingBuffer::Mix: > + float* destination = static_cast<float*>(dest->mData); > + vadd(destination, 1, reinterpret_cast<float*>(*buffers + srcOffset), 1, destination, 1, std::min<size_t>(nbytes, dest->mDataByteSize - destOffset)); > + break; This doesn't feel right. A float is not the same size as a byte, so I feel like this is going to overrun outside the bounds of the passed in list. (Well, the std::min will keep that from happening, but it'll still not behave correctly.) > Source/WebCore/platform/audio/mac/CARingBuffer.cpp:163 > + ZeroRange(static_cast<Byte**>(m_buffers->data()), m_channelCount, 0, m_capacityBytes); You shouldn't have to zero anything here. Rather, just update the bounds below. > Source/WebCore/platform/audio/mac/CARingBuffer.cpp:184 > + uint64_t start, end; > + getCurrentFrameBounds(start, end); > + if (start == end) > + setCurrentFrameBounds(startFrame, startFrame); > + What's this for?
Eric Carlson
Comment 4 2017-02-01 15:12:40 PST
Comment on attachment 300248 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=300248&action=review >> Source/WebCore/platform/audio/mac/CARingBuffer.cpp:140 >> + break; > > This doesn't feel right. A float is not the same size as a byte, so I feel like this is going to overrun outside the bounds of the passed in list. (Well, the std::min will keep that from happening, but it'll still not behave correctly.) Good point. While we the upcoming patches only use it with floats, we might as well support other the formats. >> Source/WebCore/platform/audio/mac/CARingBuffer.cpp:163 >> + ZeroRange(static_cast<Byte**>(m_buffers->data()), m_channelCount, 0, m_capacityBytes); > > You shouldn't have to zero anything here. Rather, just update the bounds below. Fixed. >> Source/WebCore/platform/audio/mac/CARingBuffer.cpp:184 >> + > > What's this for? Oops, leftover testing.
Eric Carlson
Comment 5 2017-02-01 15:13:29 PST
Created attachment 300359 [details] Updated patch, with API test.
WebKit Commit Bot
Comment 6 2017-02-01 15:16:36 PST
Attachment 300359 [details] did not pass style-queue: ERROR: Source/WebCore/platform/audio/mac/CARingBuffer.h:59: The parameter name "mode" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 1 in 14 files If any of these errors are false positives, please file a bug against check-webkit-style.
Jer Noble
Comment 7 2017-02-01 15:20:08 PST
Comment on attachment 300359 [details] Updated patch, with API test. View in context: https://bugs.webkit.org/attachment.cgi?id=300359&action=review r=me, with nit > LayoutTests/webaudio/mediastreamaudiosourcenode.html:32 > - stream.getAudioTracks()[0].stop(); > +// stream.getAudioTracks()[0].stop(); We probably still need this. :)
Eric Carlson
Comment 8 2017-02-01 15:51:59 PST
Radar WebKit Bug Importer
Comment 9 2017-02-01 15:53:25 PST
Eric Carlson
Comment 10 2017-02-01 17:50:39 PST
Plus https://trac.webkit.org/r211545 to fix the 32-bit build.
Note You need to log in before you can comment on or make changes to this bug.