Title: [246730] trunk/Source/WebCore
Revision
246730
Author
[email protected]
Date
2019-06-24 04:27:05 -0700 (Mon, 24 Jun 2019)

Log Message

[GStreamer] Volume level sometimes changes inappropriately
https://bugs.webkit.org/show_bug.cgi?id=197358

Reviewed by Xabier Rodriguez-Calvar.

Be consistent with our application of volume scaling. We were
setting volumes using cubic interpolation in setVolume() and using
the inverse in volume(); however setting initial volumes was done
linearly in setStreamVolumeElement, which was causing strange
jumps in the volume level at non-deterministic times. The fix
looks to be that we should use linear interpolation consistently,
since PulseAudio already applies cubic scaling to software
volumes.

Covered by existing tests.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::paused const): Bump the
logging here to LOG level, it's very spammy at DEBUG.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::setVolume): Switch to
linear interpolation.
(WebCore::MediaPlayerPrivateGStreamerBase::volume const): Ditto.
(WebCore::MediaPlayerPrivateGStreamerBase::notifyPlayerOfVolumeChange):
Ditto.
(WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement):
Ditto, and be consistent here with the API, do not set the raw
volume managed by MediaElement.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (246729 => 246730)


--- trunk/Source/WebCore/ChangeLog	2019-06-24 10:45:34 UTC (rev 246729)
+++ trunk/Source/WebCore/ChangeLog	2019-06-24 11:27:05 UTC (rev 246730)
@@ -1,3 +1,34 @@
+2019-06-24  Charlie Turner  <[email protected]>
+
+        [GStreamer] Volume level sometimes changes inappropriately
+        https://bugs.webkit.org/show_bug.cgi?id=197358
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Be consistent with our application of volume scaling. We were
+        setting volumes using cubic interpolation in setVolume() and using
+        the inverse in volume(); however setting initial volumes was done
+        linearly in setStreamVolumeElement, which was causing strange
+        jumps in the volume level at non-deterministic times. The fix
+        looks to be that we should use linear interpolation consistently,
+        since PulseAudio already applies cubic scaling to software
+        volumes.
+
+        Covered by existing tests.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::paused const): Bump the
+        logging here to LOG level, it's very spammy at DEBUG.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::setVolume): Switch to
+        linear interpolation.
+        (WebCore::MediaPlayerPrivateGStreamerBase::volume const): Ditto.
+        (WebCore::MediaPlayerPrivateGStreamerBase::notifyPlayerOfVolumeChange):
+        Ditto.
+        (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement):
+        Ditto, and be consistent here with the API, do not set the raw
+        volume managed by MediaElement.
+
 2019-06-24  Antoine Quint  <[email protected]>
 
         [Pointer Events] Respect pointer capture when dispatching mouse boundary events and updating :hover

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (246729 => 246730)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2019-06-24 10:45:34 UTC (rev 246729)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2019-06-24 11:27:05 UTC (rev 246730)
@@ -656,7 +656,7 @@
     GstState state;
     gst_element_get_state(m_pipeline.get(), &state, nullptr, 0);
     bool paused = state <= GST_STATE_PAUSED;
-    GST_DEBUG_OBJECT(pipeline(), "Paused: %s", toString(paused).utf8().data());
+    GST_LOG_OBJECT(pipeline(), "Paused: %s", toString(paused).utf8().data());
     return paused;
 }
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (246729 => 246730)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2019-06-24 10:45:34 UTC (rev 246729)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2019-06-24 11:27:05 UTC (rev 246730)
@@ -555,7 +555,7 @@
         return;
 
     GST_DEBUG_OBJECT(pipeline(), "Setting volume: %f", volume);
-    gst_stream_volume_set_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_CUBIC, static_cast<double>(volume));
+    gst_stream_volume_set_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_LINEAR, static_cast<double>(volume));
 }
 
 float MediaPlayerPrivateGStreamerBase::volume() const
@@ -563,7 +563,7 @@
     if (!m_volumeElement)
         return 0;
 
-    return gst_stream_volume_get_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_CUBIC);
+    return gst_stream_volume_get_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_LINEAR);
 }
 
 
@@ -572,7 +572,7 @@
     if (!m_player || !m_volumeElement)
         return;
     double volume;
-    volume = gst_stream_volume_get_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_CUBIC);
+    volume = gst_stream_volume_get_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_LINEAR);
     // get_volume() can return values superior to 1.0 if the user
     // applies software user gain via third party application (GNOME
     // volume control for instance).
@@ -1208,7 +1208,7 @@
     // https://bugs.webkit.org/show_bug.cgi?id=118974 for more information.
     if (!m_player->platformVolumeConfigurationRequired()) {
         GST_DEBUG_OBJECT(pipeline(), "Setting stream volume to %f", m_player->volume());
-        g_object_set(m_volumeElement.get(), "volume", m_player->volume(), nullptr);
+        gst_stream_volume_set_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_LINEAR, static_cast<double>(m_player->volume()));
     } else
         GST_DEBUG_OBJECT(pipeline(), "Not setting stream volume, trusting system one");
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to