Changeset 147567 in webkit
- Timestamp:
- Apr 3, 2013 11:12:40 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147566 r147567 1 2013-04-03 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 3 [Gstreamer] Use gst_buffer_extract() in copyGstreamerBuffersToAudioChannel() 4 https://bugs.webkit.org/show_bug.cgi?id=113880 5 6 Reviewed by Philippe Normand. 7 8 copyGstreamerBuffersToAudioChannel() was mapping the GstBuffer content to memcpy 9 it to the AudioChannel buffer. This patch leverages gst_buffer_extract() to 10 simplify the code as it does exactly what we need: gst_buffer_map, memcpy, 11 gst_buffer_unmap and error handling. 12 13 Also replace GstBuffer NULL check by an assertion as we already make sure they 14 are not NULL before adding them to the list. Additionally, we now call 15 audioChannel->mutableData() only once instead of once per iteration. It is 16 a bit better as the getter does some work internally. 17 18 No new tests, no behavior change. 19 20 * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp: 21 (WebCore::copyGstreamerBuffersToAudioChannel): 22 1 23 2013-04-03 Antoine Quint <graouts@apple.com> 2 24 -
trunk/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp
r146571 r147567 101 101 { 102 102 #ifdef GST_API_VERSION_1 103 gsize offset = 0; 104 for (unsigned i = 0; i < gst_buffer_list_length(buffers); i++) { 103 float* destination = audioChannel->mutableData(); 104 unsigned bufferCount = gst_buffer_list_length(buffers); 105 for (unsigned i = 0; i < bufferCount; ++i) { 105 106 GstBuffer* buffer = gst_buffer_list_get(buffers, i); 106 if (!buffer) 107 continue; 108 GstMapInfo info; 109 gst_buffer_map(buffer, &info, GST_MAP_READ); 110 memcpy(audioChannel->mutableData() + offset, reinterpret_cast<float*>(info.data), info.size); 111 offset += info.size / sizeof(float); 112 gst_buffer_unmap(buffer, &info); 107 ASSERT(buffer); 108 gsize bufferSize = gst_buffer_get_size(buffer); 109 gst_buffer_extract(buffer, 0, destination, bufferSize); 110 destination += bufferSize / sizeof(float); 113 111 } 114 112 #else
Note: See TracChangeset
for help on using the changeset viewer.