Changeset 246730 in webkit


Ignore:
Timestamp:
Jun 24, 2019 4:27:05 AM (5 years ago)
Author:
cturner@igalia.com
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.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246729 r246730  
     12019-06-24  Charlie Turner  <cturner@igalia.com>
     2
     3        [GStreamer] Volume level sometimes changes inappropriately
     4        https://bugs.webkit.org/show_bug.cgi?id=197358
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        Be consistent with our application of volume scaling. We were
     9        setting volumes using cubic interpolation in setVolume() and using
     10        the inverse in volume(); however setting initial volumes was done
     11        linearly in setStreamVolumeElement, which was causing strange
     12        jumps in the volume level at non-deterministic times. The fix
     13        looks to be that we should use linear interpolation consistently,
     14        since PulseAudio already applies cubic scaling to software
     15        volumes.
     16
     17        Covered by existing tests.
     18
     19        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
     20        (WebCore::MediaPlayerPrivateGStreamer::paused const): Bump the
     21        logging here to LOG level, it's very spammy at DEBUG.
     22        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
     23        (WebCore::MediaPlayerPrivateGStreamerBase::setVolume): Switch to
     24        linear interpolation.
     25        (WebCore::MediaPlayerPrivateGStreamerBase::volume const): Ditto.
     26        (WebCore::MediaPlayerPrivateGStreamerBase::notifyPlayerOfVolumeChange):
     27        Ditto.
     28        (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement):
     29        Ditto, and be consistent here with the API, do not set the raw
     30        volume managed by MediaElement.
     31
    1322019-06-24  Antoine Quint  <graouts@apple.com>
    233
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r246677 r246730  
    657657    gst_element_get_state(m_pipeline.get(), &state, nullptr, 0);
    658658    bool paused = state <= GST_STATE_PAUSED;
    659     GST_DEBUG_OBJECT(pipeline(), "Paused: %s", toString(paused).utf8().data());
     659    GST_LOG_OBJECT(pipeline(), "Paused: %s", toString(paused).utf8().data());
    660660    return paused;
    661661}
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

    r246710 r246730  
    556556
    557557    GST_DEBUG_OBJECT(pipeline(), "Setting volume: %f", volume);
    558     gst_stream_volume_set_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_CUBIC, static_cast<double>(volume));
     558    gst_stream_volume_set_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_LINEAR, static_cast<double>(volume));
    559559}
    560560
     
    564564        return 0;
    565565
    566     return gst_stream_volume_get_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_CUBIC);
     566    return gst_stream_volume_get_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_LINEAR);
    567567}
    568568
     
    573573        return;
    574574    double volume;
    575     volume = gst_stream_volume_get_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_CUBIC);
     575    volume = gst_stream_volume_get_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_LINEAR);
    576576    // get_volume() can return values superior to 1.0 if the user
    577577    // applies software user gain via third party application (GNOME
     
    12091209    if (!m_player->platformVolumeConfigurationRequired()) {
    12101210        GST_DEBUG_OBJECT(pipeline(), "Setting stream volume to %f", m_player->volume());
    1211         g_object_set(m_volumeElement.get(), "volume", m_player->volume(), nullptr);
     1211        gst_stream_volume_set_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_LINEAR, static_cast<double>(m_player->volume()));
    12121212    } else
    12131213        GST_DEBUG_OBJECT(pipeline(), "Not setting stream volume, trusting system one");
Note: See TracChangeset for help on using the changeset viewer.