Title: [112646] trunk/Source/WebCore
- Revision
- 112646
- Author
- [email protected]
- Date
- 2012-03-30 00:45:32 -0700 (Fri, 30 Mar 2012)
Log Message
[GTK] WebAudio channelSize issue
https://bugs.webkit.org/show_bug.cgi?id=81905
Reviewed by Martin Robinson.
* platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
(WebCore::AudioFileReader::handleBuffer): Calculate the audio
buffer duration and frames number from the buffer and caps instead
of relying on the buffer offets that are not always correctly set
depending on the audio file format.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (112645 => 112646)
--- trunk/Source/WebCore/ChangeLog 2012-03-30 07:43:10 UTC (rev 112645)
+++ trunk/Source/WebCore/ChangeLog 2012-03-30 07:45:32 UTC (rev 112646)
@@ -1,3 +1,16 @@
+2012-03-30 Philippe Normand <[email protected]>
+
+ [GTK] WebAudio channelSize issue
+ https://bugs.webkit.org/show_bug.cgi?id=81905
+
+ Reviewed by Martin Robinson.
+
+ * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
+ (WebCore::AudioFileReader::handleBuffer): Calculate the audio
+ buffer duration and frames number from the buffer and caps instead
+ of relying on the buffer offets that are not always correctly set
+ depending on the audio file format.
+
2012-03-29 Alexandru Chiculita <[email protected]>
[CSS Filters] Trigger a repaint on elements with changed filter
Modified: trunk/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp (112645 => 112646)
--- trunk/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp 2012-03-30 07:43:10 UTC (rev 112645)
+++ trunk/Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp 2012-03-30 07:45:32 UTC (rev 112646)
@@ -155,13 +155,30 @@
return GST_FLOW_ERROR;
}
+ gint sampleRate = 0;
+ if (!gst_structure_get_int(structure, "rate", &sampleRate) || !sampleRate) {
+ gst_caps_unref(caps);
+ gst_buffer_unref(buffer);
+ return GST_FLOW_ERROR;
+ }
+
+ gint width = 0;
+ if (!gst_structure_get_int(structure, "width", &width) || !width) {
+ gst_caps_unref(caps);
+ gst_buffer_unref(buffer);
+ return GST_FLOW_ERROR;
+ }
+
+ GstClockTime duration = (static_cast<guint64>(GST_BUFFER_SIZE(buffer)) * 8 * GST_SECOND) / (sampleRate * channels * width);
+ int frames = GST_CLOCK_TIME_TO_FRAMES(duration, sampleRate);
+
// Check the first audio channel. The buffer is supposed to store
// data of a single channel anyway.
GstAudioChannelPosition* positions = gst_audio_get_channel_positions(structure);
switch (positions[0]) {
case GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT:
gst_buffer_list_iterator_add(m_frontLeftBuffersIterator, buffer);
- m_channelSize += GST_BUFFER_OFFSET_END(buffer) - GST_BUFFER_OFFSET(buffer);
+ m_channelSize += frames;
break;
case GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT:
gst_buffer_list_iterator_add(m_frontRightBuffersIterator, buffer);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes