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