Changeset 78571 in webkit


Ignore:
Timestamp:
Feb 15, 2011 8:59:06 AM (13 years ago)
Author:
Philippe Normand
Message:

2011-02-15 Philippe Normand <pnormand@igalia.com>

Reviewed by Martin Robinson.

[GStreamer] Video player sets system volume to 100%
https://bugs.webkit.org/show_bug.cgi?id=54140

Don't explicitely set volume at startup and use the
GstStreamVolume interface with cubic volume scale when
updating/retrieving the volume value. This gives a much better
user-experience.

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r78569 r78571  
     12011-02-15  Philippe Normand  <pnormand@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GStreamer] Video player sets system volume to 100%
     6        https://bugs.webkit.org/show_bug.cgi?id=54140
     7
     8        Don't explicitely set volume at startup and use the
     9        GstStreamVolume interface with cubic volume scale when
     10        updating/retrieving the volume value. This gives a much better
     11        user-experience.
     12
     13        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
     14        (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
     15
    1162011-02-15  Adam Barth  <abarth@webkit.org>
    217
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r77494 r78571  
    4747#include <GOwnPtr.h>
    4848#include <gst/gst.h>
     49#include <gst/interfaces/streamvolume.h>
    4950#include <gst/video/video.h>
    5051#include <limits>
     
    641642        return;
    642643
    643     g_object_set(m_playBin, "volume", static_cast<double>(volume), NULL);
     644    gst_stream_volume_set_volume(GST_STREAM_VOLUME(m_playBin), GST_STREAM_VOLUME_FORMAT_CUBIC,
     645                                 static_cast<double>(volume));
    644646}
    645647
     
    651653        return;
    652654    double volume;
    653     g_object_get(m_playBin, "volume", &volume, NULL);
     655    volume = gst_stream_volume_get_volume(GST_STREAM_VOLUME(m_playBin), GST_STREAM_VOLUME_FORMAT_CUBIC);
     656    // get_volume() can return values superior to 1.0 if the user
     657    // applies software user gain via third party application (GNOME
     658    // volume control for instance).
     659    volume = CLAMP(volume, 0.0, 1.0);
    654660    m_player->volumeChanged(static_cast<float>(volume));
    655661}
     
    15621568    gst_object_unref(bus);
    15631569
    1564     g_object_set(m_playBin, "mute", m_player->muted(), "volume", m_player->volume(), NULL);
     1570    g_object_set(m_playBin, "mute", m_player->muted(), NULL);
    15651571
    15661572    g_signal_connect(m_playBin, "notify::volume", G_CALLBACK(mediaPlayerPrivateVolumeChangedCallback), this);
Note: See TracChangeset for help on using the changeset viewer.