Changeset 131478 in webkit
- Timestamp:
- Oct 16, 2012 11:20:12 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r131477 r131478 1 2012-10-16 Zan Dobersek <zandobersek@gmail.com> 2 3 [GStreamer] GstBuffer ref race in WebKitWebAudioSrcLoop 4 https://bugs.webkit.org/show_bug.cgi?id=95833 5 6 Reviewed by Philippe Normand. 7 8 The render bus used in GStreamer's implementation of AudioDestination no longer 9 allocates memory for each of its channels. Rather than that, when looping, the 10 data is rendered into a channel-specific GstBuffer. Each buffer is then chained 11 to the appropriate GstPad, as has been the case before. 12 13 No new tests - there are tests covering this change but they are not yet working 14 on the GTK port or any other GStreamer implementation of Web Audio. 15 16 * platform/audio/gstreamer/AudioDestinationGStreamer.cpp: 17 (WebCore::AudioDestinationGStreamer::AudioDestinationGStreamer): 18 * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: 19 (_WebKitWebAudioSourcePrivate): Remove an unused member variable. 20 (webkit_web_audio_src_init): Remove an unnecessary line. 21 (webKitWebAudioSrcConstructed): Ditto. 22 (webKitWebAudioSrcLoop): 23 1 24 2012-10-16 Pablo Flouret <pablof@motorola.com> 2 25 -
trunk/Source/WebCore/platform/audio/gstreamer/AudioDestinationGStreamer.cpp
r124264 r131478 54 54 AudioDestinationGStreamer::AudioDestinationGStreamer(AudioIOCallback& callback, float sampleRate) 55 55 : m_callback(callback) 56 , m_renderBus(2, framesToPull, true)56 , m_renderBus(2, framesToPull, false) 57 57 , m_sampleRate(sampleRate) 58 58 , m_isPlaying(false) -
trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp
r124264 r131478 50 50 AudioIOCallback* provider; 51 51 guint framesToPull; 52 guint64 currentBufferOffset;53 52 54 53 GRefPtr<GstElement> interleave; … … 186 185 priv->provider = 0; 187 186 priv->bus = 0; 188 priv->currentBufferOffset = 0;189 187 190 188 priv->mutex = g_new(GStaticRecMutex, 1); … … 219 217 gst_bin_add_many(GST_BIN(src), priv->interleave.get(), priv->wavEncoder.get(), NULL); 220 218 gst_element_link_pads_full(priv->interleave.get(), "src", priv->wavEncoder.get(), "sink", GST_PAD_LINK_CHECK_NOTHING); 221 222 219 223 220 // For each channel of the bus create a new upstream branch for interleave, like: … … 248 245 priv->pads = g_slist_reverse(priv->pads); 249 246 250 251 247 // wavenc's src pad is the only visible pad of our element. 252 248 GRefPtr<GstPad> targetPad = adoptGRef(gst_element_get_static_pad(priv->wavEncoder.get(), "src")); … … 324 320 return; 325 321 322 GSList* channelBufferList = 0; 323 unsigned bufferSize = priv->framesToPull * sizeof(float); 324 for (unsigned i = 0; i < g_slist_length(priv->pads); i++) { 325 GstBuffer* channelBuffer = gst_buffer_new_and_alloc(bufferSize); 326 ASSERT(channelBuffer); 327 channelBufferList = g_slist_prepend(channelBufferList, channelBuffer); 328 priv->bus->setChannelMemory(i, reinterpret_cast<float*>(GST_BUFFER_DATA(channelBuffer)), priv->framesToPull); 329 } 330 channelBufferList = g_slist_reverse(channelBufferList); 331 326 332 // FIXME: Add support for local/live audio input. 327 333 priv->provider->render(0, priv->bus, priv->framesToPull); 328 334 329 unsigned bufferSize = priv->framesToPull * sizeof(float); 330 for (unsigned index = 0; index < g_slist_length(priv->pads); index++) { 331 GstPad* pad = static_cast<GstPad*>(g_slist_nth_data(priv->pads, index)); 332 333 GstBuffer* buffer = gst_buffer_new(); 334 ASSERT(buffer); 335 ASSERT(!GST_BUFFER_MALLOCDATA(buffer)); 336 337 GST_BUFFER_DATA(buffer) = reinterpret_cast<guint8*>(const_cast<float*>(priv->bus->channel(index)->data())); 338 GST_BUFFER_SIZE(buffer) = bufferSize; 339 GST_BUFFER_OFFSET(buffer) = priv->currentBufferOffset; 340 GST_BUFFER_OFFSET_END(buffer) = priv->currentBufferOffset + priv->framesToPull; 335 for (unsigned i = 0; i < g_slist_length(priv->pads); i++) { 336 GstPad* pad = static_cast<GstPad*>(g_slist_nth_data(priv->pads, i)); 337 GstBuffer* channelBuffer = static_cast<GstBuffer*>(g_slist_nth_data(channelBufferList, i)); 341 338 342 339 GRefPtr<GstCaps> monoCaps = adoptGRef(getGStreamerMonoAudioCaps(priv->sampleRate)); 343 340 GstStructure* structure = gst_caps_get_structure(monoCaps.get(), 0); 344 GstAudioChannelPosition channelPosition = webKitWebAudioGStreamerChannelPosition(i ndex);341 GstAudioChannelPosition channelPosition = webKitWebAudioGStreamerChannelPosition(i); 345 342 gst_audio_set_channel_positions(structure, &channelPosition); 346 gst_buffer_set_caps( buffer, monoCaps.get());347 348 gst_pad_chain(pad, buffer);349 } 350 351 priv->currentBufferOffset += priv->framesToPull;343 gst_buffer_set_caps(channelBuffer, monoCaps.get()); 344 345 gst_pad_chain(pad, channelBuffer); 346 } 347 348 g_slist_free(channelBufferList); 352 349 } 353 350
Note: See TracChangeset
for help on using the changeset viewer.