diff -up webkitgtk-2.0.4/Source/WebCore/html/HTMLMediaElement.cpp.volume webkitgtk-2.0.4/Source/WebCore/html/HTMLMediaElement.cpp
--- webkitgtk-2.0.4/Source/WebCore/html/HTMLMediaElement.cpp.volume 2014-02-27 09:26:25.967068707 +0100
+++ webkitgtk-2.0.4/Source/WebCore/html/HTMLMediaElement.cpp 2014-02-27 09:27:56.074225330 +0100
@@ -245,6 +245,7 @@ HTMLMediaElement::HTMLMediaElement(const
, m_readyState(HAVE_NOTHING)
, m_readyStateMaximum(HAVE_NOTHING)
, m_volume(1.0f)
+ , m_volumeInitialized(false)
, m_lastSeekTime(0)
, m_previousProgressTime(numeric_limits<double>::max())
, m_lastTimeUpdateEventWallTime(0)
@@ -2665,6 +2666,7 @@ void HTMLMediaElement::setVolume(float v
if (m_volume != vol) {
m_volume = vol;
+ m_volumeInitialized = true;
updateVolume();
scheduleEvent(eventNames().volumechangeEvent);
}
@@ -3758,7 +3760,8 @@ void HTMLMediaElement::updateVolume()
}
m_player->setMuted(shouldMute);
- m_player->setVolume(m_volume * volumeMultiplier);
+ if (m_volumeInitialized)
+ m_player->setVolume(m_volume * volumeMultiplier);
}
if (hasMediaControls())
@@ -4792,6 +4795,11 @@ void HTMLMediaElement::mediaPlayerPlay()
play();
}
+bool HTMLMediaElement::mediaPlayerPlatformVolumeConfigurationRequired() const
+{
+ return !m_volumeInitialized;
+}
+
bool HTMLMediaElement::mediaPlayerIsPaused() const
{
return paused();
diff -up webkitgtk-2.0.4/Source/WebCore/html/HTMLMediaElement.h.volume webkitgtk-2.0.4/Source/WebCore/html/HTMLMediaElement.h
--- webkitgtk-2.0.4/Source/WebCore/html/HTMLMediaElement.h.volume 2014-02-27 09:26:51.671398653 +0100
+++ webkitgtk-2.0.4/Source/WebCore/html/HTMLMediaElement.h 2014-02-27 09:29:44.623618657 +0100
@@ -474,6 +474,7 @@ private:
virtual void mediaPlayerSetSize(const IntSize&) OVERRIDE;
virtual void mediaPlayerPause() OVERRIDE;
virtual void mediaPlayerPlay() OVERRIDE;
+ virtual bool mediaPlayerPlatformVolumeConfigurationRequired() const OVERRIDE;
virtual bool mediaPlayerIsPaused() const OVERRIDE;
virtual bool mediaPlayerIsLooping() const OVERRIDE;
virtual HostWindow* mediaPlayerHostWindow() OVERRIDE;
@@ -606,6 +607,7 @@ private:
RefPtr<MediaError> m_error;
float m_volume;
+ bool m_volumeInitialized;
float m_lastSeekTime;
unsigned m_previousProgress;
diff -up webkitgtk-2.0.4/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp.volume webkitgtk-2.0.4/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
--- webkitgtk-2.0.4/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp.volume 2014-02-27 09:27:38.559000504 +0100
+++ webkitgtk-2.0.4/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2014-02-27 09:27:56.075225348 +0100
@@ -72,6 +72,7 @@ static int greatestCommonDivisor(int a,
static void mediaPlayerPrivateVolumeChangedCallback(GObject*, GParamSpec*, MediaPlayerPrivateGStreamerBase* player)
{
// This is called when m_volumeElement receives the notify::volume signal.
+ LOG_MEDIA_MESSAGE("Volume changed to: %f", player->volume());
player->volumeChanged();
}
@@ -208,6 +209,7 @@ void MediaPlayerPrivateGStreamerBase::se
if (!m_volumeElement)
return;
+ LOG_MEDIA_MESSAGE("Setting volume: %f", volume);
gst_stream_volume_set_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_CUBIC, static_cast<double>(volume));
}
@@ -479,7 +481,16 @@ void MediaPlayerPrivateGStreamerBase::se
ASSERT(!m_volumeElement);
m_volumeElement = volume;
- g_object_set(m_volumeElement.get(), "mute", m_player->muted(), "volume", m_player->volume(), NULL);
+ // We don't set the initial volume because we trust the sink to keep it for us. See
+ // https://bugs.webkit.org/show_bug.cgi?id=118974 for more information.
+ if (!m_player->platformVolumeConfigurationRequired()) {
+ LOG_MEDIA_MESSAGE("Setting stream volume to %f", m_player->volume());
+ g_object_set(m_volumeElement.get(), "volume", m_player->volume(), NULL);
+ } else
+ LOG_MEDIA_MESSAGE("Not setting stream volume, trusting system one");
+
+ LOG_MEDIA_MESSAGE("Setting stream muted %d", m_player->muted());
+ g_object_set(m_volumeElement.get(), "mute", m_player->muted(), NULL);
m_volumeSignalHandler = g_signal_connect(m_volumeElement.get(), "notify::volume", G_CALLBACK(mediaPlayerPrivateVolumeChangedCallback), this);
m_muteSignalHandler = g_signal_connect(m_volumeElement.get(), "notify::mute", G_CALLBACK(mediaPlayerPrivateMuteChangedCallback), this);
diff -up webkitgtk-2.0.4/Source/WebCore/platform/graphics/MediaPlayer.h.volume webkitgtk-2.0.4/Source/WebCore/platform/graphics/MediaPlayer.h
--- webkitgtk-2.0.4/Source/WebCore/platform/graphics/MediaPlayer.h.volume 2014-02-27 09:27:17.663732299 +0100
+++ webkitgtk-2.0.4/Source/WebCore/platform/graphics/MediaPlayer.h 2014-02-27 09:30:47.663427811 +0100
@@ -209,6 +209,7 @@ public:
virtual void mediaPlayerSetSize(const IntSize&) { }
virtual void mediaPlayerPause() { }
virtual void mediaPlayerPlay() { }
+ virtual bool mediaPlayerPlatformVolumeConfigurationRequired() const { return false; }
virtual bool mediaPlayerIsPaused() const { return true; }
virtual bool mediaPlayerIsLooping() const { return false; }
virtual HostWindow* mediaPlayerHostWindow() { return 0; }
@@ -329,6 +330,7 @@ public:
float volume() const;
void setVolume(float);
+ bool platformVolumeConfigurationRequired() const { return m_mediaPlayerClient->mediaPlayerPlatformVolumeConfigurationRequired(); }
bool muted() const;
void setMuted(bool);