Changeset 154970 in webkit
- Timestamp:
- Sep 3, 2013 12:16:02 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r154968 r154970 1 2013-09-03 Xabier Rodriguez Calvar <calvaris@igalia.com> 2 3 [GStreamer] Video player sets system volume to 100% 4 https://bugs.webkit.org/show_bug.cgi?id=118974 5 6 Reviewed by Philippe Normand. 7 8 In order to preserve the system volume we need to keep track of 9 the volume being initialized in the HTMLMediaElement and then just 10 setting the volume to the sink when initializing the pipeline if 11 that volume was changed before. 12 13 * html/HTMLMediaElement.cpp: 14 (WebCore::HTMLMediaElement::HTMLMediaElement): Initialized 15 attribute to false. 16 (WebCore::HTMLMediaElement::setVolume): Set the attribute to true 17 when volume is changed. 18 (WebCore::HTMLMediaElement::updateVolume): Set the volume only if 19 volume was initialized. 20 (WebCore::HTMLMediaElement::mediaPlayerPlatformVolumeConfigurationRequired): 21 Platform volume configuration is required only if volume was not 22 initialized before. 23 * html/HTMLMediaElement.h: Added attribute and interface method. 24 * platform/graphics/MediaPlayer.h: 25 (WebCore::MediaPlayerClient::mediaPlayerPlatformVolumeConfigurationRequired): 26 Declared and added default implementation for the interface method. 27 (WebCore::MediaPlayer::platformVolumeConfigurationRequired): 28 Asked the client, meaning the HTMLMediaElement if the platform 29 volume configuration is required. 30 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: 31 (WebCore::mediaPlayerPrivateVolumeChangedCallback): Added log. 32 (WebCore::MediaPlayerPrivateGStreamerBase::setVolume): Added log. 33 (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): 34 Set the volume only if not platform volume is required and added log. 35 1 36 2013-09-02 Darin Adler <darin@apple.com> 2 37 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r154962 r154970 268 268 , m_readyStateMaximum(HAVE_NOTHING) 269 269 , m_volume(1.0f) 270 , m_volumeInitialized(false) 270 271 , m_lastSeekTime(0) 271 272 , m_previousProgressTime(numeric_limits<double>::max()) … … 2709 2710 if (m_volume != vol) { 2710 2711 m_volume = vol; 2712 m_volumeInitialized = true; 2711 2713 updateVolume(); 2712 2714 scheduleEvent(eventNames().volumechangeEvent); … … 3979 3981 3980 3982 m_player->setMuted(shouldMute); 3981 m_player->setVolume(m_volume * volumeMultiplier); 3983 if (m_volumeInitialized) 3984 m_player->setVolume(m_volume * volumeMultiplier); 3982 3985 } 3983 3986 … … 5082 5085 } 5083 5086 5087 bool HTMLMediaElement::mediaPlayerPlatformVolumeConfigurationRequired() const 5088 { 5089 return !m_volumeInitialized; 5090 } 5091 5084 5092 bool HTMLMediaElement::mediaPlayerIsPaused() const 5085 5093 { -
trunk/Source/WebCore/html/HTMLMediaElement.h
r154559 r154970 508 508 virtual void mediaPlayerPause() OVERRIDE; 509 509 virtual void mediaPlayerPlay() OVERRIDE; 510 virtual bool mediaPlayerPlatformVolumeConfigurationRequired() const OVERRIDE; 510 511 virtual bool mediaPlayerIsPaused() const OVERRIDE; 511 512 virtual bool mediaPlayerIsLooping() const OVERRIDE; … … 639 640 640 641 double m_volume; 642 bool m_volumeInitialized; 641 643 double m_lastSeekTime; 642 644 -
trunk/Source/WebCore/platform/graphics/MediaPlayer.h
r154921 r154970 215 215 virtual void mediaPlayerPause() { } 216 216 virtual void mediaPlayerPlay() { } 217 virtual bool mediaPlayerPlatformVolumeConfigurationRequired() const { return false; } 217 218 virtual bool mediaPlayerIsPaused() const { return true; } 218 219 virtual bool mediaPlayerIsLooping() const { return false; } … … 330 331 double volume() const; 331 332 void setVolume(double); 333 bool platformVolumeConfigurationRequired() const { return m_mediaPlayerClient->mediaPlayerPlatformVolumeConfigurationRequired(); } 332 334 333 335 bool muted() const; -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
r154088 r154970 77 77 { 78 78 // This is called when m_volumeElement receives the notify::volume signal. 79 LOG_MEDIA_MESSAGE("Volume changed to: %f", player->volume()); 79 80 player->volumeChanged(); 80 81 } … … 235 236 return; 236 237 238 LOG_MEDIA_MESSAGE("Setting volume: %f", volume); 237 239 gst_stream_volume_set_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_CUBIC, static_cast<double>(volume)); 238 240 } … … 619 621 m_volumeElement = volume; 620 622 621 g_object_set(m_volumeElement.get(), "mute", m_player->muted(), "volume", m_player->volume(), NULL); 623 // We don't set the initial volume because we trust the sink to keep it for us. See 624 // https://bugs.webkit.org/show_bug.cgi?id=118974 for more information. 625 if (!m_player->platformVolumeConfigurationRequired()) { 626 LOG_MEDIA_MESSAGE("Setting stream volume to %f", m_player->volume()); 627 g_object_set(m_volumeElement.get(), "volume", m_player->volume(), NULL); 628 } else 629 LOG_MEDIA_MESSAGE("Not setting stream volume, trusting system one"); 630 631 LOG_MEDIA_MESSAGE("Setting stream muted %d", m_player->muted()); 632 g_object_set(m_volumeElement.get(), "mute", m_player->muted(), NULL); 622 633 623 634 m_volumeSignalHandler = g_signal_connect(m_volumeElement.get(), "notify::volume", G_CALLBACK(mediaPlayerPrivateVolumeChangedCallback), this);
Note: See TracChangeset
for help on using the changeset viewer.