Changeset 287618 in webkit
- Timestamp:
- Jan 5, 2022, 10:20:33 AM (5 years ago)
- Location:
- branches/safari-612-branch
- Files:
-
- 4 edited
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/audio/cocoa/CARingBuffer.cpp (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebCore/CARingBuffer.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612-branch/Source/WebCore/ChangeLog
r287337 r287618 1 2022-01-05 Russell Epstein <repstein@apple.com> 2 3 Cherry-pick r284980. rdar://problem/84223894 4 5 Fix CARingBuffer mix mode 6 https://bugs.webkit.org/show_bug.cgi?id=232427 7 Source/WebCore: 8 9 Reviewed by Eric Carlson. 10 11 Like done for Copy, we need to use the destination offset to write data properly. 12 13 Covered by API test. 14 15 * platform/audio/cocoa/CARingBuffer.cpp: 16 17 Tools: 18 19 <rdar://problem/84747657> 20 21 Reviewed by Eric Carlson. 22 23 * TestWebKitAPI/Tests/WebCore/CARingBuffer.cpp: 24 25 26 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284980 268f45cc-cd09-0410-ab3c-d52691b4dbfc 27 28 2021-10-28 Youenn Fablet <youenn@apple.com> 29 30 Fix CARingBuffer mix mode 31 https://bugs.webkit.org/show_bug.cgi?id=232427 32 33 Reviewed by Eric Carlson. 34 35 Like done for Copy, we need to use the destination offset to write data properly. 36 37 Covered by API test. 38 39 * platform/audio/cocoa/CARingBuffer.cpp: 40 1 41 2021-12-21 Alan Coon <alancoon@apple.com> 2 42 -
branches/safari-612-branch/Source/WebCore/platform/audio/cocoa/CARingBuffer.cpp
r281001 r287618 167 167 continue; 168 168 169 auto* destinationData = static_cast<Byte*>(dest->mData) + destOffset; 170 auto* sourceData = pointer + srcOffset; 169 171 nbytes = std::min<size_t>(nbytes, dest->mDataByteSize - destOffset); 170 172 if (mode == CARingBuffer::Copy) 171 memcpy( static_cast<Byte*>(dest->mData) + destOffset, pointer + srcOffset, nbytes);173 memcpy(destinationData, sourceData, nbytes); 172 174 else { 173 175 switch (format) { 174 176 case AudioStreamDescription::Int16: { 175 int16_t* destination = static_cast<int16_t*>(dest->mData);176 int16_t* source = reinterpret_cast<int16_t*>(pointer + srcOffset);177 auto* destination = reinterpret_cast<int16_t*>(destinationData); 178 auto* source = reinterpret_cast<int16_t*>(sourceData); 177 179 for (size_t i = 0; i < nbytes / sizeof(int16_t); i++) 178 180 destination[i] += source[i]; … … 180 182 } 181 183 case AudioStreamDescription::Int32: { 182 int32_t* destination = static_cast<int32_t*>(dest->mData);183 vDSP_vaddi(destination, 1, reinterpret_cast<int32_t*>( pointer + srcOffset), 1, destination, 1, nbytes / sizeof(int32_t));184 auto* destination = reinterpret_cast<int32_t*>(destinationData); 185 vDSP_vaddi(destination, 1, reinterpret_cast<int32_t*>(sourceData), 1, destination, 1, nbytes / sizeof(int32_t)); 184 186 break; 185 187 } 186 188 case AudioStreamDescription::Float32: { 187 float* destination = static_cast<float*>(dest->mData);188 vDSP_vadd(destination, 1, reinterpret_cast<float*>( pointer + srcOffset), 1, destination, 1, nbytes / sizeof(float));189 auto* destination = reinterpret_cast<float*>(destinationData); 190 vDSP_vadd(destination, 1, reinterpret_cast<float*>(sourceData), 1, destination, 1, nbytes / sizeof(float)); 189 191 break; 190 192 } 191 193 case AudioStreamDescription::Float64: { 192 double* destination = static_cast<double*>(dest->mData);193 vDSP_vaddD(destination, 1, reinterpret_cast<double*>( pointer + srcOffset), 1, destination, 1, nbytes / sizeof(double));194 auto* destination = reinterpret_cast<double*>(destinationData); 195 vDSP_vaddD(destination, 1, reinterpret_cast<double*>(sourceData), 1, destination, 1, nbytes / sizeof(double)); 194 196 break; 195 197 } -
branches/safari-612-branch/Tools/ChangeLog
r287332 r287618 1 2022-01-05 Russell Epstein <repstein@apple.com> 2 3 Cherry-pick r284980. rdar://problem/84223894 4 5 Fix CARingBuffer mix mode 6 https://bugs.webkit.org/show_bug.cgi?id=232427 7 Source/WebCore: 8 9 Reviewed by Eric Carlson. 10 11 Like done for Copy, we need to use the destination offset to write data properly. 12 13 Covered by API test. 14 15 * platform/audio/cocoa/CARingBuffer.cpp: 16 17 Tools: 18 19 <rdar://problem/84747657> 20 21 Reviewed by Eric Carlson. 22 23 * TestWebKitAPI/Tests/WebCore/CARingBuffer.cpp: 24 25 26 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284980 268f45cc-cd09-0410-ab3c-d52691b4dbfc 27 28 2021-10-28 Youenn Fablet <youenn@apple.com> 29 30 Fix CARingBuffer mix mode 31 https://bugs.webkit.org/show_bug.cgi?id=232427 32 <rdar://problem/84747657> 33 34 Reviewed by Eric Carlson. 35 36 * TestWebKitAPI/Tests/WebCore/CARingBuffer.cpp: 37 1 38 2021-12-21 Robert Jenner <Jenner@apple.com> 2 39 -
branches/safari-612-branch/Tools/TestWebKitAPI/Tests/WebCore/CARingBuffer.cpp
r270663 r287618 153 153 static void run(CARingBufferTest& test) 154 154 { 155 const int sampleCount = 64;155 const int sampleCount = 441; 156 156 157 157 CAAudioStreamDescription::PCMFormat format; … … 198 198 for (int i = 0; i < sampleCount; i++) 199 199 EXPECT_EQ(readBuffer[i], referenceBuffer[i]) << "Ring buffer value differs at index " << i; 200 201 test.ringBuffer().fetch(&test.bufferList(), sampleCount, 0, CARingBuffer::FetchMode::Copy); 202 err = test.ringBuffer().store(&test.bufferList(), sampleCount, sampleCount); 203 EXPECT_EQ(err, CARingBuffer::Error::Ok); 204 205 test.ringBuffer().fetch(&test.bufferList(), sampleCount, sampleCount, CARingBuffer::FetchMode::Copy); 206 test.ringBuffer().fetch(&test.bufferList(), sampleCount, sampleCount, CARingBuffer::FetchMode::Mix); 207 test.ringBuffer().fetch(&test.bufferList(), sampleCount, sampleCount, CARingBuffer::FetchMode::Mix); 208 209 for (int i = 0; i < sampleCount; i++) 210 referenceBuffer[i] = sourceBuffer[i] * 3; 211 212 for (int i = 0; i < sampleCount; i++) 213 EXPECT_EQ(readBuffer[i], referenceBuffer[i]) << "Ring buffer value differs at index " << i; 200 214 } 201 215 };
Note:
See TracChangeset
for help on using the changeset viewer.