[GStreamer] MediaPlayerPrivateGStreamer style cleanups
authorcturner@igalia.com <cturner@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Nov 2019 10:24:54 +0000 (10:24 +0000)
committercturner@igalia.com <cturner@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Nov 2019 10:24:54 +0000 (10:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=204617

Reviewed by Xabier Rodriguez-Calvar.

Follow-up commit to bug 204352 addressing style issues in the
existing player code. The main issues addressed are naming
violations, adding final to types not overridden and organizing
better the scope of names in the classes.

Covered by existing tests.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::initializeDebugCategory):
(WebCore::MediaPlayerPrivateGStreamer::loadFull):
(WebCore::MediaPlayerPrivateGStreamer::prepareToPlay):
(WebCore::MediaPlayerPrivateGStreamer::play):
(WebCore::MediaPlayerPrivateGStreamer::pause):
(WebCore::MediaPlayerPrivateGStreamer::paused const):
(WebCore::MediaPlayerPrivateGStreamer::doSeek):
(WebCore::MediaPlayerPrivateGStreamer::seek):
(WebCore::MediaPlayerPrivateGStreamer::updatePlaybackRate):
(WebCore::MediaPlayerPrivateGStreamer::currentMediaTime const):
(WebCore::MediaPlayerPrivateGStreamer::setRate):
(WebCore::MediaPlayerPrivateGStreamer::setPreservesPitch):
(WebCore::MediaPlayerPrivateGStreamer::setPreload):
(WebCore::MediaPlayerPrivateGStreamer::buffered const):
(WebCore::MediaPlayerPrivateGStreamer::maxMediaTimeSeekable const):
(WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const):
(WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const):
(WebCore::MediaPlayerPrivateGStreamer::totalBytes const):
(WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio):
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText):
(WebCore::MediaPlayerPrivateGStreamer::platformDuration const):
(WebCore::MediaPlayerPrivateGStreamer::isMuted const):
(WebCore::MediaPlayerPrivateGStreamer::commitLoad):
(WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
(WebCore::MediaPlayerPrivateGStreamer::loadingFailed):
(WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
(WebCore::MediaPlayerPrivateGStreamer::enableTrack):
(WebCore::MediaPlayerPrivateGStreamer::updateTracks):
(WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage):
(WebCore::MediaPlayerPrivateGStreamer::naturalSize const):
(WebCore::MediaPlayerPrivateGStreamer::setMuted):
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):
(WebCore::MediaPlayerPrivateGStreamer::updateBufferingStatus):
(WebCore::MediaPlayerPrivateGStreamer::processMpegTsSection):
(WebCore::MediaPlayerPrivateGStreamer::processTableOfContentsEntry):
(WebCore::MediaPlayerPrivateGStreamer::asyncStateChangeDone):
(WebCore::MediaPlayerPrivateGStreamer::updateStates):
(WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
(WebCore::MediaPlayerPrivateGStreamer::didEnd):
(WebCore::MediaPlayerPrivateGStreamer::updateDownloadBufferingFlag):
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
(WebCore::MediaPlayerPrivateGStreamer::canSaveMediaData const):
(WebCore::MediaPlayerPrivateGStreamer::acceleratedRenderingStateChanged):
(WebCore::MediaPlayerPrivateGStreamer::pushTextureToCompositor):
(WebCore::MediaPlayerPrivateGStreamer::triggerRepaint):
(WebCore::MediaPlayerPrivateGStreamer::cancelRepaint):
(WebCore::MediaPlayerPrivateGStreamer::paint):
(WebCore::MediaPlayerPrivateGStreamer::copyVideoTextureToPlatformTexture):
(WebCore::MediaPlayerPrivateGStreamer::nativeImageForCurrentTime):
(WebCore::MediaPlayerPrivateGStreamer::movieLoadType const):
(WebCore::MediaPlayerPrivateGStreamer::createVideoSink):
(WebCore::MediaPlayerPrivateGStreamer::decodedFrameCount const):
(WebCore::MediaPlayerPrivateGStreamer::droppedFrameCount const):
(WebCore::MediaPlayerPrivateGStreamer::attemptToDecryptWithLocalInstance):
(WebCore::MediaPlayerPrivateGStreamer::setWaitingForKey):
(WebCore::MediaPlayerPrivateGStreamer::initializeDebugCategory): Deleted.
(WebCore::MediaPlayerPrivateGStreamer::sizeChanged): Deleted.
(WebCore::MediaPlayerPrivateGStreamer::muted const): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(WebCore::MediaPlayerPrivateGStreamer::pipeline const):
(WebCore::MediaPlayerPrivateGStreamer::mediaPlayer const): Deleted.
(WebCore::MediaPlayerPrivateGStreamer::isLiveStream const): Deleted.
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::pause):
(WebCore::MediaPlayerPrivateGStreamerMSE::durationMediaTime const):
(WebCore::MediaPlayerPrivateGStreamerMSE::seek):
(WebCore::MediaPlayerPrivateGStreamerMSE::doSeek):
(WebCore::MediaPlayerPrivateGStreamerMSE::maybeFinishSeek):
(WebCore::MediaPlayerPrivateGStreamerMSE::seeking const):
(WebCore::MediaPlayerPrivateGStreamerMSE::waitForSeekCompleted):
(WebCore::MediaPlayerPrivateGStreamerMSE::updateStates):
(WebCore::MediaPlayerPrivateGStreamerMSE::asyncStateChangeDone):
(WebCore::MediaPlayerPrivateGStreamerMSE::maxMediaTimeSeekable const):
* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
* platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
(WebCore::MediaSourceClientGStreamerMSE::flush):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252937 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h
Source/WebCore/platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp

index 66e6451..85912a9 100644 (file)
@@ -1,3 +1,97 @@
+2019-11-29  Charlie Turner  <cturner@igalia.com>
+
+        [GStreamer] MediaPlayerPrivateGStreamer style cleanups
+        https://bugs.webkit.org/show_bug.cgi?id=204617
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Follow-up commit to bug 204352 addressing style issues in the
+        existing player code. The main issues addressed are naming
+        violations, adding final to types not overridden and organizing
+        better the scope of names in the classes.
+
+        Covered by existing tests.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::initializeDebugCategory):
+        (WebCore::MediaPlayerPrivateGStreamer::loadFull):
+        (WebCore::MediaPlayerPrivateGStreamer::prepareToPlay):
+        (WebCore::MediaPlayerPrivateGStreamer::play):
+        (WebCore::MediaPlayerPrivateGStreamer::pause):
+        (WebCore::MediaPlayerPrivateGStreamer::paused const):
+        (WebCore::MediaPlayerPrivateGStreamer::doSeek):
+        (WebCore::MediaPlayerPrivateGStreamer::seek):
+        (WebCore::MediaPlayerPrivateGStreamer::updatePlaybackRate):
+        (WebCore::MediaPlayerPrivateGStreamer::currentMediaTime const):
+        (WebCore::MediaPlayerPrivateGStreamer::setRate):
+        (WebCore::MediaPlayerPrivateGStreamer::setPreservesPitch):
+        (WebCore::MediaPlayerPrivateGStreamer::setPreload):
+        (WebCore::MediaPlayerPrivateGStreamer::buffered const):
+        (WebCore::MediaPlayerPrivateGStreamer::maxMediaTimeSeekable const):
+        (WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const):
+        (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const):
+        (WebCore::MediaPlayerPrivateGStreamer::totalBytes const):
+        (WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
+        (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
+        (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio):
+        (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText):
+        (WebCore::MediaPlayerPrivateGStreamer::platformDuration const):
+        (WebCore::MediaPlayerPrivateGStreamer::isMuted const):
+        (WebCore::MediaPlayerPrivateGStreamer::commitLoad):
+        (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
+        (WebCore::MediaPlayerPrivateGStreamer::loadingFailed):
+        (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
+        (WebCore::MediaPlayerPrivateGStreamer::enableTrack):
+        (WebCore::MediaPlayerPrivateGStreamer::updateTracks):
+        (WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage):
+        (WebCore::MediaPlayerPrivateGStreamer::naturalSize const):
+        (WebCore::MediaPlayerPrivateGStreamer::setMuted):
+        (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
+        (WebCore::MediaPlayerPrivateGStreamer::updateBufferingStatus):
+        (WebCore::MediaPlayerPrivateGStreamer::processMpegTsSection):
+        (WebCore::MediaPlayerPrivateGStreamer::processTableOfContentsEntry):
+        (WebCore::MediaPlayerPrivateGStreamer::asyncStateChangeDone):
+        (WebCore::MediaPlayerPrivateGStreamer::updateStates):
+        (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
+        (WebCore::MediaPlayerPrivateGStreamer::didEnd):
+        (WebCore::MediaPlayerPrivateGStreamer::updateDownloadBufferingFlag):
+        (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
+        (WebCore::MediaPlayerPrivateGStreamer::canSaveMediaData const):
+        (WebCore::MediaPlayerPrivateGStreamer::acceleratedRenderingStateChanged):
+        (WebCore::MediaPlayerPrivateGStreamer::pushTextureToCompositor):
+        (WebCore::MediaPlayerPrivateGStreamer::triggerRepaint):
+        (WebCore::MediaPlayerPrivateGStreamer::cancelRepaint):
+        (WebCore::MediaPlayerPrivateGStreamer::paint):
+        (WebCore::MediaPlayerPrivateGStreamer::copyVideoTextureToPlatformTexture):
+        (WebCore::MediaPlayerPrivateGStreamer::nativeImageForCurrentTime):
+        (WebCore::MediaPlayerPrivateGStreamer::movieLoadType const):
+        (WebCore::MediaPlayerPrivateGStreamer::createVideoSink):
+        (WebCore::MediaPlayerPrivateGStreamer::decodedFrameCount const):
+        (WebCore::MediaPlayerPrivateGStreamer::droppedFrameCount const):
+        (WebCore::MediaPlayerPrivateGStreamer::attemptToDecryptWithLocalInstance):
+        (WebCore::MediaPlayerPrivateGStreamer::setWaitingForKey):
+        (WebCore::MediaPlayerPrivateGStreamer::initializeDebugCategory): Deleted.
+        (WebCore::MediaPlayerPrivateGStreamer::sizeChanged): Deleted.
+        (WebCore::MediaPlayerPrivateGStreamer::muted const): Deleted.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        (WebCore::MediaPlayerPrivateGStreamer::pipeline const):
+        (WebCore::MediaPlayerPrivateGStreamer::mediaPlayer const): Deleted.
+        (WebCore::MediaPlayerPrivateGStreamer::isLiveStream const): Deleted.
+        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerMSE::pause):
+        (WebCore::MediaPlayerPrivateGStreamerMSE::durationMediaTime const):
+        (WebCore::MediaPlayerPrivateGStreamerMSE::seek):
+        (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek):
+        (WebCore::MediaPlayerPrivateGStreamerMSE::maybeFinishSeek):
+        (WebCore::MediaPlayerPrivateGStreamerMSE::seeking const):
+        (WebCore::MediaPlayerPrivateGStreamerMSE::waitForSeekCompleted):
+        (WebCore::MediaPlayerPrivateGStreamerMSE::updateStates):
+        (WebCore::MediaPlayerPrivateGStreamerMSE::asyncStateChangeDone):
+        (WebCore::MediaPlayerPrivateGStreamerMSE::maxMediaTimeSeekable const):
+        * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
+        * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
+        (WebCore::MediaSourceClientGStreamerMSE::flush):
+
 2019-11-28  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         Remove ENABLE_KEYBOARD_CODE_ATTRIBUTE and ENABLE_KEYBOARD_KEY_ATTRIBUTE macros
index 579ed99..8849412 100644 (file)
@@ -336,9 +336,12 @@ private:
 };
 #endif
 
-void MediaPlayerPrivateGStreamer::initializeDebugCategory()
+static void initializeDebugCategory()
 {
-    GST_DEBUG_CATEGORY_INIT(webkit_media_player_debug, "webkitmediaplayer", 0, "WebKit media player");
+    static std::once_flag onceFlag;
+    std::call_once(onceFlag, [] {
+        GST_DEBUG_CATEGORY_INIT(webkit_media_player_debug, "webkitmediaplayer", 0, "WebKit media player");
+    });
 }
 
 MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer(MediaPlayer* player)
@@ -497,7 +500,7 @@ void MediaPlayerPrivateGStreamer::loadFull(const String& urlString, const String
     GST_DEBUG_OBJECT(pipeline(), "preload: %s", convertEnumerationToString(m_preload).utf8().data());
     if (m_preload == MediaPlayer::None) {
         GST_INFO_OBJECT(pipeline(), "Delaying load.");
-        m_delayingLoad = true;
+        m_isDelayingLoad = true;
     }
 
     // Reset network and ready states. Those will be set properly once
@@ -506,10 +509,10 @@ void MediaPlayerPrivateGStreamer::loadFull(const String& urlString, const String
     m_player->networkStateChanged();
     m_readyState = MediaPlayer::HaveNothing;
     m_player->readyStateChanged();
-    m_volumeAndMuteInitialized = false;
+    m_areVolumeAndMuteInitialized = false;
     m_hasTaintedOrigin = WTF::nullopt;
 
-    if (!m_delayingLoad)
+    if (!m_isDelayingLoad)
         commitLoad();
 }
 
@@ -541,19 +544,6 @@ void MediaPlayerPrivateGStreamer::load(MediaStreamPrivate& stream)
 }
 #endif
 
-void MediaPlayerPrivateGStreamer::commitLoad()
-{
-    ASSERT(!m_delayingLoad);
-    GST_DEBUG_OBJECT(pipeline(), "Committing load.");
-
-    // GStreamer needs to have the pipeline set to a paused state to
-    // start providing anything useful.
-    changePipelineState(GST_STATE_PAUSED);
-
-    updateDownloadBufferingFlag();
-    updateStates();
-}
-
 void MediaPlayerPrivateGStreamer::cancelLoad()
 {
     if (m_networkState < MediaPlayer::Loading || m_networkState == MediaPlayer::Loaded)
@@ -567,8 +557,8 @@ void MediaPlayerPrivateGStreamer::prepareToPlay()
 {
     GST_DEBUG_OBJECT(pipeline(), "Prepare to play");
     m_preload = MediaPlayer::Auto;
-    if (m_delayingLoad) {
-        m_delayingLoad = false;
+    if (m_isDelayingLoad) {
+        m_isDelayingLoad = false;
         commitLoad();
     }
 }
@@ -576,13 +566,13 @@ void MediaPlayerPrivateGStreamer::prepareToPlay()
 void MediaPlayerPrivateGStreamer::play()
 {
     if (!m_playbackRate) {
-        m_playbackRatePause = true;
+        m_isPlaybackRatePaused = true;
         return;
     }
 
     if (changePipelineState(GST_STATE_PLAYING)) {
         m_isEndReached = false;
-        m_delayingLoad = false;
+        m_isDelayingLoad = false;
         m_preload = MediaPlayer::Auto;
         updateDownloadBufferingFlag();
         GST_INFO_OBJECT(pipeline(), "Play");
@@ -592,7 +582,7 @@ void MediaPlayerPrivateGStreamer::play()
 
 void MediaPlayerPrivateGStreamer::pause()
 {
-    m_playbackRatePause = false;
+    m_isPlaybackRatePaused = false;
     GstState currentState, pendingState;
     gst_element_get_state(m_pipeline.get(), &currentState, &pendingState, 0);
     if (currentState < GST_STATE_PAUSED && pendingState <= GST_STATE_PAUSED)
@@ -614,7 +604,7 @@ bool MediaPlayerPrivateGStreamer::paused() const
         return true;
     }
 
-    if (m_playbackRatePause) {
+    if (m_isPlaybackRatePaused) {
         GST_DEBUG_OBJECT(pipeline(), "Playback rate is 0, simulating PAUSED state");
         return false;
     }
@@ -633,12 +623,8 @@ bool MediaPlayerPrivateGStreamer::doSeek(const MediaTime& position, float rate,
 
     if (rate < 0) {
         startTime = MediaTime::zeroTime();
-        // If we are at beginning of media, start from the end to
-        // avoid immediate EOS.
-        if (position < MediaTime::zeroTime())
-            endTime = durationMediaTime();
-        else
-            endTime = position;
+        // If we are at beginning of media, start from the end to avoid immediate EOS.
+        endTime = position < MediaTime::zeroTime() ? durationMediaTime() : position;
     }
 
     if (!rate)
@@ -650,10 +636,7 @@ bool MediaPlayerPrivateGStreamer::doSeek(const MediaTime& position, float rate,
 
 void MediaPlayerPrivateGStreamer::seek(const MediaTime& mediaTime)
 {
-    if (!m_pipeline)
-        return;
-
-    if (m_errorOccured)
+    if (!m_pipeline || m_didErrorOccur)
         return;
 
     GST_INFO_OBJECT(pipeline(), "[Seek] seek attempt to %s", toString(mediaTime).utf8().data());
@@ -666,16 +649,16 @@ void MediaPlayerPrivateGStreamer::seek(const MediaTime& mediaTime)
 
     MediaTime time = std::min(mediaTime, durationMediaTime());
 
-    if (isLiveStream()) {
+    if (m_isLiveStream) {
         GST_DEBUG_OBJECT(pipeline(), "[Seek] Live stream seek unhandled");
         return;
     }
 
     GST_INFO_OBJECT(pipeline(), "[Seek] seeking to %s", toString(time).utf8().data());
 
-    if (m_seeking) {
+    if (m_isSeeking) {
         m_timeOfOverlappingSeek = time;
-        if (m_seekIsPending) {
+        if (m_isSeekPending) {
             m_seekTime = time;
             return;
         }
@@ -688,10 +671,10 @@ void MediaPlayerPrivateGStreamer::seek(const MediaTime& mediaTime)
         return;
     }
     if (getStateResult == GST_STATE_CHANGE_ASYNC || state < GST_STATE_PAUSED || m_isEndReached) {
-        m_seekIsPending = true;
+        m_isSeekPending = true;
         if (m_isEndReached) {
             GST_DEBUG_OBJECT(pipeline(), "[Seek] reset pipeline");
-            m_resetPipeline = true;
+            m_shouldResetPipeline = true;
             if (!changePipelineState(GST_STATE_PAUSED))
                 loadingFailed(MediaPlayer::Empty);
         }
@@ -703,20 +686,20 @@ void MediaPlayerPrivateGStreamer::seek(const MediaTime& mediaTime)
         }
     }
 
-    m_seeking = true;
+    m_isSeeking = true;
     m_seekTime = time;
     m_isEndReached = false;
 }
 
 void MediaPlayerPrivateGStreamer::updatePlaybackRate()
 {
-    if (!m_changingRate)
+    if (!m_isChangingRate)
         return;
 
     GST_INFO_OBJECT(pipeline(), "Set Rate to %f", m_playbackRate);
 
     // Mute the sound if the playback rate is negative or too extreme and audio pitch is not adjusted.
-    bool mute = m_playbackRate <= 0 || (!m_preservesPitch && (m_playbackRate < 0.8 || m_playbackRate > 2));
+    bool mute = m_playbackRate <= 0 || (!m_shouldPreservePitch && (m_playbackRate < 0.8 || m_playbackRate > 2));
 
     GST_INFO_OBJECT(pipeline(), mute ? "Need to mute audio" : "Do not need to mute audio");
 
@@ -728,43 +711,19 @@ void MediaPlayerPrivateGStreamer::updatePlaybackRate()
         GST_ERROR("Set rate to %f failed", m_playbackRate);
     }
 
-    if (m_playbackRatePause) {
-        GstState state;
-        GstState pending;
+    if (m_isPlaybackRatePaused) {
+        GstState state, pending;
 
         gst_element_get_state(m_pipeline.get(), &state, &pending, 0);
         if (state != GST_STATE_PLAYING && pending != GST_STATE_PLAYING)
             changePipelineState(GST_STATE_PLAYING);
-        m_playbackRatePause = false;
+        m_isPlaybackRatePaused = false;
     }
 
-    m_changingRate = false;
+    m_isChangingRate = false;
     m_player->rateChanged();
 }
 
-MediaTime MediaPlayerPrivateGStreamer::platformDuration() const
-{
-    if (!m_pipeline)
-        return MediaTime::invalidTime();
-
-    GST_TRACE_OBJECT(pipeline(), "errorOccured: %s, pipeline state: %s", boolForPrinting(m_errorOccured), gst_element_state_get_name(GST_STATE(m_pipeline.get())));
-    if (m_errorOccured)
-        return MediaTime::invalidTime();
-
-    // The duration query would fail on a not-prerolled pipeline.
-    if (GST_STATE(m_pipeline.get()) < GST_STATE_PAUSED)
-        return MediaTime::invalidTime();
-
-    int64_t duration = 0;
-    if (!gst_element_query_duration(m_pipeline.get(), GST_FORMAT_TIME, &duration) || !GST_CLOCK_TIME_IS_VALID(duration)) {
-        GST_DEBUG_OBJECT(pipeline(), "Time duration query failed for %s", m_url.string().utf8().data());
-        return MediaTime::positiveInfiniteTime();
-    }
-
-    GST_LOG_OBJECT(pipeline(), "Duration: %" GST_TIME_FORMAT, GST_TIME_ARGS(duration));
-    return MediaTime(duration, GST_SECOND);
-}
-
 MediaTime MediaPlayerPrivateGStreamer::durationMediaTime() const
 {
     GST_TRACE_OBJECT(pipeline(), "Cached duration: %s", m_cachedDuration.toString().utf8().data());
@@ -782,11 +741,11 @@ MediaTime MediaPlayerPrivateGStreamer::durationMediaTime() const
 
 MediaTime MediaPlayerPrivateGStreamer::currentMediaTime() const
 {
-    if (!m_pipeline || m_errorOccured)
+    if (!m_pipeline || m_didErrorOccur)
         return MediaTime::invalidTime();
 
-    GST_TRACE_OBJECT(pipeline(), "seeking: %s, seekTime: %s", boolForPrinting(m_seeking), m_seekTime.toString().utf8().data());
-    if (m_seeking)
+    GST_TRACE_OBJECT(pipeline(), "seeking: %s, seekTime: %s", boolForPrinting(m_isSeeking), m_seekTime.toString().utf8().data());
+    if (m_isSeeking)
         return m_seekTime;
 
     return playbackPosition();
@@ -794,36 +753,36 @@ MediaTime MediaPlayerPrivateGStreamer::currentMediaTime() const
 
 void MediaPlayerPrivateGStreamer::setRate(float rate)
 {
-    // Higher rate causes crash.
-    rate = clampTo(rate, -20.0, 20.0);
+    float rateClamped = clampTo(rate, -20.0, 20.0);
+    if (rateClamped != rate)
+        GST_WARNING("Clamping original rate (%f) to [-20, 20] (%f), higher rates cause crashes", rate, rateClamped);
 
     // Avoid useless playback rate update.
-    if (m_playbackRate == rate) {
-        // and make sure that upper layers were notified if rate was set
+    if (m_playbackRate == rateClamped) {
+        // And make sure that upper layers were notified if rate was set.
 
-        if (!m_changingRate && m_player->rate() != m_playbackRate)
+        if (!m_isChangingRate && m_player->rate() != m_playbackRate)
             m_player->rateChanged();
         return;
     }
 
-    if (isLiveStream()) {
-        // notify upper layers that we cannot handle passed rate.
-        m_changingRate = false;
+    if (m_isLiveStream) {
+        // Notify upper layers that we cannot handle passed rate.
+        m_isChangingRate = false;
         m_player->rateChanged();
         return;
     }
 
-    GstState state;
-    GstState pending;
+    GstState state, pending;
 
-    m_playbackRate = rate;
-    m_changingRate = true;
+    m_playbackRate = rateClamped;
+    m_isChangingRate = true;
 
     gst_element_get_state(m_pipeline.get(), &state, &pending, 0);
 
-    if (!rate) {
-        m_changingRate = false;
-        m_playbackRatePause = true;
+    if (!rateClamped) {
+        m_isChangingRate = false;
+        m_isPlaybackRatePaused = true;
         if (state != GST_STATE_PAUSED && pending != GST_STATE_PAUSED)
             changePipelineState(GST_STATE_PAUSED);
         return;
@@ -843,20 +802,20 @@ double MediaPlayerPrivateGStreamer::rate() const
 
 void MediaPlayerPrivateGStreamer::setPreservesPitch(bool preservesPitch)
 {
-    m_preservesPitch = preservesPitch;
+    m_shouldPreservePitch = preservesPitch;
 }
 
 void MediaPlayerPrivateGStreamer::setPreload(MediaPlayer::Preload preload)
 {
     GST_DEBUG_OBJECT(pipeline(), "Setting preload to %s", convertEnumerationToString(preload).utf8().data());
-    if (preload == MediaPlayer::Auto && isLiveStream())
+    if (preload == MediaPlayer::Auto && m_isLiveStream)
         return;
 
     m_preload = preload;
     updateDownloadBufferingFlag();
 
-    if (m_delayingLoad && m_preload != MediaPlayer::None) {
-        m_delayingLoad = false;
+    if (m_isDelayingLoad && m_preload != MediaPlayer::None) {
+        m_isDelayingLoad = false;
         commitLoad();
     }
 }
@@ -864,7 +823,7 @@ void MediaPlayerPrivateGStreamer::setPreload(MediaPlayer::Preload preload)
 std::unique_ptr<PlatformTimeRanges> MediaPlayerPrivateGStreamer::buffered() const
 {
     auto timeRanges = makeUnique<PlatformTimeRanges>();
-    if (m_errorOccured || isLiveStream())
+    if (m_didErrorOccur || m_isLiveStream)
         return timeRanges;
 
     MediaTime mediaDuration = durationMediaTime();
@@ -876,8 +835,8 @@ std::unique_ptr<PlatformTimeRanges> MediaPlayerPrivateGStreamer::buffered() cons
     if (!gst_element_query(m_pipeline.get(), query.get()))
         return timeRanges;
 
-    guint numBufferingRanges = gst_query_get_n_buffering_ranges(query.get());
-    for (guint index = 0; index < numBufferingRanges; index++) {
+    unsigned numBufferingRanges = gst_query_get_n_buffering_ranges(query.get());
+    for (unsigned index = 0; index < numBufferingRanges; index++) {
         gint64 rangeStart = 0, rangeStop = 0;
         if (gst_query_parse_nth_buffering_range(query.get(), index, &rangeStart, &rangeStop)) {
             uint64_t startTime = gst_util_uint64_scale_int_round(toGstUnsigned64Time(mediaDuration), rangeStart, GST_FORMAT_PERCENT_MAX);
@@ -886,8 +845,7 @@ std::unique_ptr<PlatformTimeRanges> MediaPlayerPrivateGStreamer::buffered() cons
         }
     }
 
-    // Fallback to the more general maxTimeLoaded() if no range has
-    // been found.
+    // Fallback to the more general maxTimeLoaded() if no range has been found.
     if (!timeRanges->length()) {
         MediaTime loaded = maxTimeLoaded();
         if (loaded.isValid() && loaded)
@@ -899,16 +857,16 @@ std::unique_ptr<PlatformTimeRanges> MediaPlayerPrivateGStreamer::buffered() cons
 
 MediaTime MediaPlayerPrivateGStreamer::maxMediaTimeSeekable() const
 {
-    GST_TRACE_OBJECT(pipeline(), "errorOccured: %s, isLiveStream: %s", boolForPrinting(m_errorOccured), boolForPrinting(isLiveStream()));
-    if (m_errorOccured)
+    GST_TRACE_OBJECT(pipeline(), "errorOccured: %s, isLiveStream: %s", boolForPrinting(m_didErrorOccur), boolForPrinting(m_isLiveStream));
+    if (m_didErrorOccur)
         return MediaTime::zeroTime();
 
-    if (isLiveStream())
+    if (m_isLiveStream)
         return MediaTime::zeroTime();
 
     MediaTime duration = durationMediaTime();
     GST_DEBUG_OBJECT(pipeline(), "maxMediaTimeSeekable, duration: %s", toString(duration).utf8().data());
-    // infinite duration means live stream
+    // Infinite duration means live stream.
     if (duration.isPositiveInfinite())
         return MediaTime::zeroTime();
 
@@ -917,7 +875,7 @@ MediaTime MediaPlayerPrivateGStreamer::maxMediaTimeSeekable() const
 
 MediaTime MediaPlayerPrivateGStreamer::maxTimeLoaded() const
 {
-    if (m_errorOccured)
+    if (m_didErrorOccur)
         return MediaTime::zeroTime();
 
     MediaTime loaded = m_maxTimeLoaded;
@@ -929,7 +887,7 @@ MediaTime MediaPlayerPrivateGStreamer::maxTimeLoaded() const
 
 bool MediaPlayerPrivateGStreamer::didLoadingProgress() const
 {
-    if (m_errorOccured || m_loadingStalled)
+    if (m_didErrorOccur || m_loadingStalled)
         return false;
 
     if (WEBKIT_IS_WEB_SRC(m_source.get())) {
@@ -952,29 +910,22 @@ bool MediaPlayerPrivateGStreamer::didLoadingProgress() const
 
 unsigned long long MediaPlayerPrivateGStreamer::totalBytes() const
 {
-    if (m_errorOccured)
+    if (m_didErrorOccur || !m_source || m_isLiveStream)
         return 0;
 
     if (m_totalBytes)
         return m_totalBytes;
 
-    if (!m_source)
-        return 0;
-
-    if (isLiveStream())
-        return 0;
-
     GstFormat fmt = GST_FORMAT_BYTES;
     gint64 length = 0;
     if (gst_element_query_duration(m_source.get(), fmt, &length)) {
         GST_INFO_OBJECT(pipeline(), "totalBytes %" G_GINT64_FORMAT, length);
         m_totalBytes = static_cast<unsigned long long>(length);
-        m_isStreaming = !length;
+        m_isLiveStream = !length;
         return m_totalBytes;
     }
 
-    // Fall back to querying the source pads manually.
-    // See also https://bugzilla.gnome.org/show_bug.cgi?id=638749
+    // Fall back to querying the source pads manually. See also https://bugzilla.gnome.org/show_bug.cgi?id=638749
     GstIterator* iter = gst_element_iterate_src_pads(m_source.get());
     bool done = false;
     while (!done) {
@@ -1004,7 +955,7 @@ unsigned long long MediaPlayerPrivateGStreamer::totalBytes() const
 
     GST_INFO_OBJECT(pipeline(), "totalBytes %" G_GINT64_FORMAT, length);
     m_totalBytes = static_cast<unsigned long long>(length);
-    m_isStreaming = !length;
+    m_isLiveStream = !length;
     return m_totalBytes;
 }
 
@@ -1129,8 +1080,7 @@ bool MediaPlayerPrivateGStreamer::changePipelineState(GstState newState)
 {
     ASSERT(m_pipeline);
 
-    GstState currentState;
-    GstState pending;
+    GstState currentState, pending;
 
     gst_element_get_state(m_pipeline.get(), &currentState, &pending, 0);
     if (currentState == newState || pending == newState) {
@@ -1147,13 +1097,10 @@ bool MediaPlayerPrivateGStreamer::changePipelineState(GstState newState)
     if (currentState != pausedOrPlaying && setStateResult == GST_STATE_CHANGE_FAILURE)
         return false;
 
-    // Create a timer when entering the READY state so that we can free resources
-    // if we stay for too long on READY.
-    // Also lets remove the timer if we request a state change for any state other than READY.
-    // See also https://bugs.webkit.org/show_bug.cgi?id=117354
+    // Create a timer when entering the READY state so that we can free resources if we stay for too long on READY.
+    // Also lets remove the timer if we request a state change for any state other than READY. See also https://bugs.webkit.org/show_bug.cgi?id=117354
     if (newState == GST_STATE_READY && !m_readyTimerHandler.isActive()) {
-        // Max interval in seconds to stay in the READY state on manual
-        // state change requests.
+        // Max interval in seconds to stay in the READY state on manual state change requests.
         static const Seconds readyStateTimerDelay { 1_min };
         m_readyTimerHandler.startOneShot(readyStateTimerDelay);
     } else if (newState != GST_STATE_READY)
@@ -1197,17 +1144,37 @@ void MediaPlayerPrivateGStreamer::syncOnClock(bool sync)
     setSyncOnClock(audioSink(), sync);
 }
 
-void MediaPlayerPrivateGStreamer::notifyPlayerOfVideo()
+enum MediaType {
+    Video, Audio, Text
+};
+void MediaPlayerPrivateGStreamer::notifyPlayerOf(MediaType mediaType)
 {
     if (UNLIKELY(!m_pipeline || !m_source))
         return;
 
     ASSERT(m_isLegacyPlaybin || isMediaSource());
 
-    gint numTracks = 0;
+    const char *mediaType;
+    const char *sourceType;
+    switch (mediaType) {
+    case MediaType::Video:
+        mediaType = "video";
+        sourceType = "n-video";        
+        break;
+    case MediaType::Audio:
+        mediaType = "audio";
+        sourceType = "n-audio";        
+        break;
+    case MediaType::Text:
+        mediaType = "text";
+        sourceType = "n-text";
+        break;
+    }
+
+    unsigned numTracks = 0;
     bool useMediaSource = isMediaSource();
     GstElement* element = useMediaSource ? m_source.get() : m_pipeline.get();
-    g_object_get(element, "n-video", &numTracks, nullptr);
+    g_object_get(element, sourceType, &numTracks, nullptr);
 
     GST_INFO_OBJECT(pipeline(), "Media has %d video tracks", numTracks);
 
@@ -1227,14 +1194,14 @@ void MediaPlayerPrivateGStreamer::notifyPlayerOfVideo()
 
 #if ENABLE(VIDEO_TRACK)
     Vector<String> validVideoStreams;
-    for (gint i = 0; i < numTracks; ++i) {
+    for (unsigned i = 0; i < numTracks; ++i) {
         GRefPtr<GstPad> pad;
         g_signal_emit_by_name(m_pipeline.get(), "get-video-pad", i, &pad.outPtr(), nullptr);
         ASSERT(pad);
 
         String streamId = "V" + String::number(i);
         validVideoStreams.append(streamId);
-        if (i < static_cast<gint>(m_videoTracks.size())) {
+        if (i < m_videoTracks.size()) {
             RefPtr<VideoTrackPrivateGStreamer> existingTrack = m_videoTracks.get(streamId);
             if (existingTrack) {
                 existingTrack->setIndex(i);
@@ -1255,6 +1222,10 @@ void MediaPlayerPrivateGStreamer::notifyPlayerOfVideo()
     m_player->client().mediaPlayerEngineUpdated(m_player);
 }
 
+void MediaPlayerPrivateGStreamer::notifyPlayerOfVideo()
+{
+}
+
 void MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback(MediaPlayerPrivateGStreamer* player)
 {
     player->m_notifier->notify(MainThreadNotification::VideoCapsChanged, [player] {
@@ -1282,7 +1253,7 @@ void MediaPlayerPrivateGStreamer::notifyPlayerOfAudio()
 
     ASSERT(m_isLegacyPlaybin || isMediaSource());
 
-    gint numTracks = 0;
+    unsigned numTracks = 0;
     bool useMediaSource = isMediaSource();
     GstElement* element = useMediaSource ? m_source.get() : m_pipeline.get();
     g_object_get(element, "n-audio", &numTracks, nullptr);
@@ -1301,14 +1272,14 @@ void MediaPlayerPrivateGStreamer::notifyPlayerOfAudio()
 
 #if ENABLE(VIDEO_TRACK)
     Vector<String> validAudioStreams;
-    for (gint i = 0; i < numTracks; ++i) {
+    for (unsigned i = 0; i < numTracks; ++i) {
         GRefPtr<GstPad> pad;
         g_signal_emit_by_name(m_pipeline.get(), "get-audio-pad", i, &pad.outPtr(), nullptr);
         ASSERT(pad);
 
         String streamId = "A" + String::number(i);
         validAudioStreams.append(streamId);
-        if (i < static_cast<gint>(m_audioTracks.size())) {
+        if (i < m_audioTracks.size()) {
             RefPtr<AudioTrackPrivateGStreamer> existingTrack = m_audioTracks.get(streamId);
             if (existingTrack) {
                 existingTrack->setIndex(i);
@@ -1344,7 +1315,7 @@ void MediaPlayerPrivateGStreamer::notifyPlayerOfText()
 
     ASSERT(m_isLegacyPlaybin || isMediaSource());
 
-    gint numTracks = 0;
+    unsigned numTracks = 0;
     bool useMediaSource = isMediaSource();
     GstElement* element = useMediaSource ? m_source.get() : m_pipeline.get();
     g_object_get(element, "n-text", &numTracks, nullptr);
@@ -1357,7 +1328,7 @@ void MediaPlayerPrivateGStreamer::notifyPlayerOfText()
     }
 
     Vector<String> validTextStreams;
-    for (gint i = 0; i < numTracks; ++i) {
+    for (unsigned i = 0; i < numTracks; ++i) {
         GRefPtr<GstPad> pad;
         g_signal_emit_by_name(m_pipeline.get(), "get-text-pad", i, &pad.outPtr(), nullptr);
         ASSERT(pad);
@@ -1369,7 +1340,7 @@ void MediaPlayerPrivateGStreamer::notifyPlayerOfText()
         String streamId = "T" + String::number(i);
 
         validTextStreams.append(streamId);
-        if (i < static_cast<gint>(m_textTracks.size())) {
+        if (i < m_textTracks.size()) {
             RefPtr<InbandTextTrackPrivateGStreamer> existingTrack = m_textTracks.get(streamId);
             if (existingTrack) {
                 existingTrack->setIndex(i);
@@ -1422,9 +1393,56 @@ void MediaPlayerPrivateGStreamer::newTextSample()
 }
 #endif
 
+MediaTime MediaPlayerPrivateGStreamer::platformDuration() const
+{
+    if (!m_pipeline)
+        return MediaTime::invalidTime();
+
+    GST_TRACE_OBJECT(pipeline(), "errorOccured: %s, pipeline state: %s", boolForPrinting(m_didErrorOccur), gst_element_state_get_name(GST_STATE(m_pipeline.get())));
+    if (m_didErrorOccur)
+        return MediaTime::invalidTime();
+
+    // The duration query would fail on a not-prerolled pipeline.
+    if (GST_STATE(m_pipeline.get()) < GST_STATE_PAUSED)
+        return MediaTime::invalidTime();
+
+    int64_t duration = 0;
+    if (!gst_element_query_duration(m_pipeline.get(), GST_FORMAT_TIME, &duration) || !GST_CLOCK_TIME_IS_VALID(duration)) {
+        GST_DEBUG_OBJECT(pipeline(), "Time duration query failed for %s", m_url.string().utf8().data());
+        return MediaTime::positiveInfiniteTime();
+    }
+
+    GST_LOG_OBJECT(pipeline(), "Duration: %" GST_TIME_FORMAT, GST_TIME_ARGS(duration));
+    return MediaTime(duration, GST_SECOND);
+}
+
+bool MediaPlayerPrivateGStreamer::isMuted() const
+{
+    if (!m_volumeElement)
+        return false;
+
+    gboolean isMuted;
+    g_object_get(m_volumeElement.get(), "mute", &isMuted, nullptr);
+    GST_INFO_OBJECT(pipeline(), "Player is muted: %s", boolForPrinting(!!isMuted));
+    return isMuted;
+}
+
+void MediaPlayerPrivateGStreamer::commitLoad()
+{
+    ASSERT(!m_isDelayingLoad);
+    GST_DEBUG_OBJECT(pipeline(), "Committing load.");
+
+    // GStreamer needs to have the pipeline set to a paused state to
+    // start providing anything useful.
+    changePipelineState(GST_STATE_PAUSED);
+
+    updateDownloadBufferingFlag();
+    updateStates();
+}
+
 void MediaPlayerPrivateGStreamer::fillTimerFired()
 {
-    if (m_errorOccured) {
+    if (m_didErrorOccur) {
         GST_DEBUG_OBJECT(pipeline(), "[Buffering] An error occurred, disabling the fill timer");
         m_fillTimer.stop();
         return;
@@ -1466,7 +1484,7 @@ void MediaPlayerPrivateGStreamer::loadingFailed(MediaPlayer::NetworkState networ
 {
     GST_WARNING("Loading failed, error: %s", convertEnumerationToString(networkError).utf8().data());
 
-    m_errorOccured = true;
+    m_didErrorOccur = true;
     if (forceNotifications || m_networkState != networkError) {
         m_networkState = networkError;
         m_player->networkStateChanged();
@@ -1509,8 +1527,8 @@ GstElement* MediaPlayerPrivateGStreamer::audioSink() const
 
 MediaTime MediaPlayerPrivateGStreamer::playbackPosition() const
 {
-    GST_TRACE_OBJECT(pipeline(), "isEndReached: %s, seeking: %s, seekTime: %s", boolForPrinting(m_isEndReached), boolForPrinting(m_seeking), m_seekTime.toString().utf8().data());
-    if (m_isEndReached && m_seeking)
+    GST_TRACE_OBJECT(pipeline(), "isEndReached: %s, seeking: %s, seekTime: %s", boolForPrinting(m_isEndReached), boolForPrinting(m_isSeeking), m_seekTime.toString().utf8().data());
+    if (m_isEndReached && m_isSeeking)
         return m_seekTime;
 
     // This constant should remain lower than HTMLMediaElement's maxTimeupdateEventFrequency.
@@ -1530,10 +1548,11 @@ MediaTime MediaPlayerPrivateGStreamer::playbackPosition() const
         gst_query_parse_position(query, 0, &position);
     gst_query_unref(query);
 
-    GST_TRACE_OBJECT(pipeline(), "Position %" GST_TIME_FORMAT ", canFallBackToLastFinishedSeekPosition: %s", GST_TIME_ARGS(position), boolForPrinting(m_canFallBackToLastFinishedSeekPosition));
+    GstClockTime gstreamerPosition = static_cast<GstClockTime>(position);
+    GST_TRACE_OBJECT(pipeline(), "Position %" GST_TIME_FORMAT ", canFallBackToLastFinishedSeekPosition: %s", GST_TIME_ARGS(gstreamerPosition), boolForPrinting(m_canFallBackToLastFinishedSeekPosition));
 
     MediaTime playbackPosition = MediaTime::zeroTime();
-    GstClockTime gstreamerPosition = static_cast<GstClockTime>(position);
+
     if (GST_CLOCK_TIME_IS_VALID(gstreamerPosition))
         playbackPosition = MediaTime(gstreamerPosition, GST_SECOND);
     else if (m_canFallBackToLastFinishedSeekPosition)
@@ -1609,6 +1628,7 @@ void MediaPlayerPrivateGStreamer::enableTrack(TrackPrivateBaseGStreamer::TrackTy
             selectedStreams.append(m_currentVideoStreamId);
         break;
     case TrackPrivateBaseGStreamer::TrackType::Unknown:
+        FALLTHROUGH;
     default:
         ASSERT_NOT_REACHED();
     }
@@ -1660,7 +1680,7 @@ void MediaPlayerPrivateGStreamer::updateTracks()
             GST_WARNING("Unknown track type found for stream %s", streamId.utf8().data());
     }
 
-    if ((oldHasVideo != m_hasVideo) || (oldHasAudio != m_hasAudio))
+    if (oldHasVideo != m_hasVideo || oldHasAudio != m_hasAudio)
         m_player->characteristicChanged();
 
     if (m_hasVideo)
@@ -1720,7 +1740,9 @@ bool MediaPlayerPrivateGStreamer::handleSyncMessage(GstMessage* message)
         return false;
 
     const gchar* contextType;
-    gst_message_parse_context_type(message, &contextType);
+    if (!gst_message_parse_context_type(message, &contextType))
+        return false;
+
     GST_DEBUG_OBJECT(pipeline(), "Handling %s need-context message for %s", contextType, GST_MESSAGE_SRC_NAME(message));
 
     if (!g_strcmp0(contextType, WEBKIT_WEB_SRC_PLAYER_CONTEXT_TYPE_NAME)) {
@@ -1771,7 +1793,7 @@ bool MediaPlayerPrivateGStreamer::handleSyncMessage(GstMessage* message)
             gst_structure_set(contextStructure, "decryption-system-id", G_TYPE_STRING, preferredKeySystemUuid, nullptr);
             gst_element_set_context(GST_ELEMENT(GST_MESSAGE_SRC(message)), context.get());
         } else
-            GST_WARNING("CDM instance not initializaed");
+            GST_WARNING("CDM instance not initialized");
 
         return true;
     }
@@ -1781,7 +1803,7 @@ bool MediaPlayerPrivateGStreamer::handleSyncMessage(GstMessage* message)
     return false;
 }
 
-// Returns the size of the video
+// Returns the size of the video.
 FloatSize MediaPlayerPrivateGStreamer::naturalSize() const
 {
 #if USE(GSTREAMER_HOLEPUNCH)
@@ -1819,10 +1841,8 @@ FloatSize MediaPlayerPrivateGStreamer::naturalSize() const
     if (!caps)
         return FloatSize();
 
-    // TODO: handle possible clean aperture data. See
-    // https://bugzilla.gnome.org/show_bug.cgi?id=596571
-    // TODO: handle possible transformation matrix. See
-    // https://bugzilla.gnome.org/show_bug.cgi?id=596326
+    // TODO: handle possible clean aperture data. See https://bugzilla.gnome.org/show_bug.cgi?id=596571
+    // TODO: handle possible transformation matrix. See https://bugzilla.gnome.org/show_bug.cgi?id=596326
 
     // Get the video PAR and original size, if this fails the
     // video-sink has likely not yet negotiated its caps.
@@ -1834,7 +1854,7 @@ FloatSize MediaPlayerPrivateGStreamer::naturalSize() const
 
 #if USE(TEXTURE_MAPPER_GL)
     // When using accelerated compositing, if the video is tagged as rotated 90 or 270 degrees, swap width and height.
-    if (m_renderingCanBeAccelerated) {
+    if (m_canRenderingBeAccelerated) {
         if (m_videoSourceOrientation.usesWidthAsHeight())
             originalSize = originalSize.transposedSize();
     }
@@ -1853,19 +1873,19 @@ FloatSize MediaPlayerPrivateGStreamer::naturalSize() const
     displayHeight /= displayAspectRatioGCD;
 
     // Apply DAR to original video size. This is the same behavior as in xvimagesink's setcaps function.
-    guint64 width = 0, height = 0;
+    uint64_t width = 0, height = 0;
     if (!(originalSize.height() % displayHeight)) {
         GST_DEBUG_OBJECT(pipeline(), "Keeping video original height");
         width = gst_util_uint64_scale_int(originalSize.height(), displayWidth, displayHeight);
-        height = static_cast<guint64>(originalSize.height());
+        height = originalSize.height();
     } else if (!(originalSize.width() % displayWidth)) {
         GST_DEBUG_OBJECT(pipeline(), "Keeping video original width");
         height = gst_util_uint64_scale_int(originalSize.width(), displayHeight, displayWidth);
-        width = static_cast<guint64>(originalSize.width());
+        width = originalSize.width();
     } else {
         GST_DEBUG_OBJECT(pipeline(), "Approximating while keeping original video height");
         width = gst_util_uint64_scale_int(originalSize.height(), displayWidth, displayHeight);
-        height = static_cast<guint64>(originalSize.height());
+        height = originalSize.height();
     }
 
     GST_DEBUG_OBJECT(pipeline(), "Natural size: %" G_GUINT64_FORMAT "x%" G_GUINT64_FORMAT, width, height);
@@ -1923,33 +1943,13 @@ MediaPlayer::ReadyState MediaPlayerPrivateGStreamer::readyState() const
     return m_readyState;
 }
 
-void MediaPlayerPrivateGStreamer::sizeChanged()
+void MediaPlayerPrivateGStreamer::setMuted(bool shouldMute)
 {
-    notImplemented();
-}
-
-void MediaPlayerPrivateGStreamer::setMuted(bool mute)
-{
-    if (!m_volumeElement)
+    if (!m_volumeElement || shouldMute == isMuted())
         return;
 
-    bool currentValue = muted();
-    if (currentValue == mute)
-        return;
-
-    GST_INFO_OBJECT(pipeline(), "Set muted to %s", toString(mute).utf8().data());
-    g_object_set(m_volumeElement.get(), "mute", mute, nullptr);
-}
-
-bool MediaPlayerPrivateGStreamer::muted() const
-{
-    if (!m_volumeElement)
-        return false;
-
-    gboolean muted;
-    g_object_get(m_volumeElement.get(), "mute", &muted, nullptr);
-    GST_INFO_OBJECT(pipeline(), "Player is muted: %s", toString(static_cast<bool>(muted)).utf8().data());
-    return muted;
+    GST_INFO_OBJECT(pipeline(), "Muted? %s", boolForPrinting(shouldMute));
+    g_object_set(m_volumeElement.get(), "mute", shouldMute, nullptr);
 }
 
 void MediaPlayerPrivateGStreamer::notifyPlayerOfMute()
@@ -1999,7 +1999,7 @@ void MediaPlayerPrivateGStreamer::handleMessage(GstMessage* message)
     GST_LOG_OBJECT(pipeline(), "Message %s received from element %s", GST_MESSAGE_TYPE_NAME(message), GST_MESSAGE_SRC_NAME(message));
     switch (GST_MESSAGE_TYPE(message)) {
     case GST_MESSAGE_ERROR:
-        if (m_resetPipeline || !m_missingPluginCallbacks.isEmpty() || m_errorOccured)
+        if (m_shouldResetPipeline || !m_missingPluginCallbacks.isEmpty() || m_didErrorOccur)
             break;
         gst_message_parse_error(message, &err.outPtr(), &debug.outPtr());
         GST_ERROR("Error %d: %s (url=%s)", err->code, err->message, m_url.string().utf8().data());
@@ -2014,9 +2014,7 @@ void MediaPlayerPrivateGStreamer::handleMessage(GstMessage* message)
             || g_error_matches(err.get(), GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_NOT_FOUND))
             error = MediaPlayer::FormatError;
         else if (g_error_matches(err.get(), GST_STREAM_ERROR, GST_STREAM_ERROR_TYPE_NOT_FOUND)) {
-            // Let the mediaPlayerClient handle the stream error, in
-            // this case the HTMLMediaElement will emit a stalled
-            // event.
+            // Let the mediaPlayerClient handle the stream error, in this case the HTMLMediaElement will emit a stalled event.
             GST_ERROR("Decode error, let the Media element emit a stalled event.");
             m_loadingStalled = true;
             break;
@@ -2029,7 +2027,7 @@ void MediaPlayerPrivateGStreamer::handleMessage(GstMessage* message)
         if (attemptNextLocation)
             issueError = !loadNextLocation();
         if (issueError) {
-            m_errorOccured = true;
+            m_didErrorOccur = true;
             if (m_networkState != error) {
                 m_networkState = error;
                 m_player->networkStateChanged();
@@ -2040,12 +2038,12 @@ void MediaPlayerPrivateGStreamer::handleMessage(GstMessage* message)
         didEnd();
         break;
     case GST_MESSAGE_ASYNC_DONE:
-        if (!messageSourceIsPlaybin || m_delayingLoad)
+        if (!messageSourceIsPlaybin || m_isDelayingLoad)
             break;
         asyncStateChangeDone();
         break;
     case GST_MESSAGE_STATE_CHANGED: {
-        if (!messageSourceIsPlaybin || m_delayingLoad)
+        if (!messageSourceIsPlaybin || m_isDelayingLoad)
             break;
         updateStates();
 
@@ -2176,8 +2174,8 @@ void MediaPlayerPrivateGStreamer::handleMessage(GstMessage* message)
                     }
                 }
                 if (!isRangeRequest) {
-                    m_isStreaming = !contentLength;
-                    GST_INFO_OBJECT(pipeline(), "%s stream detected", m_isStreaming ? "Live" : "Non-live");
+                    m_isLiveStream = !contentLength;
+                    GST_INFO_OBJECT(pipeline(), "%s stream detected", m_isLiveStream ? "Live" : "Non-live");
                     updateDownloadBufferingFlag();
                 }
             }
@@ -2285,15 +2283,15 @@ void MediaPlayerPrivateGStreamer::updateBufferingStatus(GstBufferingMode mode, d
 {
     GST_DEBUG_OBJECT(pipeline(), "[Buffering] mode: %s, status: %f%%", enumToString(GST_TYPE_BUFFERING_MODE, mode).data(), percentage);
 
-    m_downloadFinished = percentage == 100;
-    m_buffering = !m_downloadFinished;
+    m_didDownloadFinish = percentage == 100;
+    m_isBuffering = !m_didDownloadFinish;
 
     switch (mode) {
     case GST_BUFFERING_STREAM: {
         updateMaxTimeLoaded(percentage);
 
         m_bufferingPercentage = percentage;
-        if (m_downloadFinished)
+        if (m_didDownloadFinish)
             updateStates();
 
         break;
@@ -2303,7 +2301,7 @@ void MediaPlayerPrivateGStreamer::updateBufferingStatus(GstBufferingMode mode, d
 
         // Media is now fully loaded. It will play even if network connection is
         // cut. Buffering is done, remove the fill source from the main loop.
-        if (m_downloadFinished)
+        if (m_didDownloadFinish)
             m_fillTimer.stop();
 
         updateStates();
@@ -2323,7 +2321,7 @@ void MediaPlayerPrivateGStreamer::processMpegTsSection(GstMpegtsSection* section
     if (section->section_type == GST_MPEGTS_SECTION_PMT) {
         const GstMpegtsPMT* pmt = gst_mpegts_section_get_pmt(section);
         m_metadataTracks.clear();
-        for (guint i = 0; i < pmt->streams->len; ++i) {
+        for (unsigned i = 0; i < pmt->streams->len; ++i) {
             const GstMpegtsPMTStream* stream = static_cast<const GstMpegtsPMTStream*>(g_ptr_array_index(pmt->streams, i));
             if (stream->stream_type == 0x05 || stream->stream_type >= 0x80) {
                 AtomString pid = String::number(stream->pid);
@@ -2342,9 +2340,9 @@ void MediaPlayerPrivateGStreamer::processMpegTsSection(GstMpegtsSection* section
                 // expressed in hexadecimal using uppercase ASCII hex digits.
                 String inbandMetadataTrackDispatchType;
                 appendUnsignedAsHexFixedSize(stream->stream_type, inbandMetadataTrackDispatchType, 2);
-                for (guint j = 0; j < stream->descriptors->len; ++j) {
+                for (unsigned j = 0; j < stream->descriptors->len; ++j) {
                     const GstMpegtsDescriptor* descriptor = static_cast<const GstMpegtsDescriptor*>(g_ptr_array_index(stream->descriptors, j));
-                    for (guint k = 0; k < descriptor->length; ++k)
+                    for (unsigned k = 0; k < descriptor->length; ++k)
                         appendByteAsHex(descriptor->data[k], inbandMetadataTrackDispatchType);
                 }
                 track->setInBandMetadataTrackDispatchType(inbandMetadataTrackDispatchType);
@@ -2394,10 +2392,12 @@ void MediaPlayerPrivateGStreamer::processTableOfContentsEntry(GstTocEntry* entry
 
     gint64 start = -1, stop = -1;
     gst_toc_entry_get_start_stop_times(entry, &start, &stop);
+
+    uint32_t truncatedGstSecond = static_cast<uint32_t>(GST_SECOND);
     if (start != -1)
-        cue->setStartTime(MediaTime(start, GST_SECOND));
+        cue->setStartTime(MediaTime(static_cast<int64_t>(start), truncatedGstSecond));
     if (stop != -1)
-        cue->setEndTime(MediaTime(stop, GST_SECOND));
+        cue->setEndTime(MediaTime(static_cast<int64_t>(stop), truncatedGstSecond));
 
     GstTagList* tags = gst_toc_entry_get_tags(entry);
     if (tags) {
@@ -2495,15 +2495,15 @@ void MediaPlayerPrivateGStreamer::purgeOldDownloadFiles(const char* downloadFile
 
 void MediaPlayerPrivateGStreamer::asyncStateChangeDone()
 {
-    if (!m_pipeline || m_errorOccured)
+    if (!m_pipeline || m_didErrorOccur)
         return;
 
-    if (m_seeking) {
-        if (m_seekIsPending)
+    if (m_isSeeking) {
+        if (m_isSeekPending)
             updateStates();
         else {
             GST_DEBUG_OBJECT(pipeline(), "[Seek] seeked to %s", toString(m_seekTime).utf8().data());
-            m_seeking = false;
+            m_isSeeking = false;
             m_cachedPosition = MediaTime::invalidTime();
             if (m_timeOfOverlappingSeek != m_seekTime && m_timeOfOverlappingSeek.isValid()) {
                 seek(m_timeOfOverlappingSeek);
@@ -2523,16 +2523,12 @@ void MediaPlayerPrivateGStreamer::asyncStateChangeDone()
 
 void MediaPlayerPrivateGStreamer::updateStates()
 {
-    if (!m_pipeline)
-        return;
-
-    if (m_errorOccured)
+    if (!m_pipeline || m_didErrorOccur)
         return;
 
     MediaPlayer::NetworkState oldNetworkState = m_networkState;
     MediaPlayer::ReadyState oldReadyState = m_readyState;
-    GstState pending;
-    GstState state;
+    GstState pending, state;
     bool stateReallyChanged = false;
 
     GstStateChangeReturn getStateResult = gst_element_get_state(m_pipeline.get(), &state, &pending, 250 * GST_NSECOND);
@@ -2552,9 +2548,9 @@ void MediaPlayerPrivateGStreamer::updateStates()
         if (m_isEndReached && m_currentState == GST_STATE_READY)
             break;
 
-        m_resetPipeline = m_currentState <= GST_STATE_READY;
+        m_shouldResetPipeline = m_currentState <= GST_STATE_READY;
 
-        bool didBuffering = m_buffering;
+        bool didBuffering = m_isBuffering;
 
         // Update ready and network states.
         switch (m_currentState) {
@@ -2568,17 +2564,17 @@ void MediaPlayerPrivateGStreamer::updateStates()
             break;
         case GST_STATE_PAUSED:
         case GST_STATE_PLAYING:
-            if (m_buffering) {
+            if (m_isBuffering) {
                 if (m_bufferingPercentage == 100) {
                     GST_DEBUG_OBJECT(pipeline(), "[Buffering] Complete.");
-                    m_buffering = false;
+                    m_isBuffering = false;
                     m_readyState = MediaPlayer::HaveEnoughData;
-                    m_networkState = m_downloadFinished ? MediaPlayer::Idle : MediaPlayer::Loading;
+                    m_networkState = m_didDownloadFinish ? MediaPlayer::Idle : MediaPlayer::Loading;
                 } else {
                     m_readyState = MediaPlayer::HaveCurrentData;
                     m_networkState = MediaPlayer::Loading;
                 }
-            } else if (m_downloadFinished) {
+            } else if (m_didDownloadFinish) {
                 m_readyState = MediaPlayer::HaveEnoughData;
                 m_networkState = MediaPlayer::Loaded;
             } else {
@@ -2594,25 +2590,25 @@ void MediaPlayerPrivateGStreamer::updateStates()
 
         // Sync states where needed.
         if (m_currentState == GST_STATE_PAUSED) {
-            if (!m_volumeAndMuteInitialized) {
+            if (!m_areVolumeAndMuteInitialized) {
                 notifyPlayerOfVolumeChange();
                 notifyPlayerOfMute();
-                m_volumeAndMuteInitialized = true;
+                m_areVolumeAndMuteInitialized = true;
             }
 
-            if (didBuffering && !m_buffering && !m_paused && m_playbackRate) {
+            if (didBuffering && !m_isBuffering && !m_isPaused && m_playbackRate) {
                 GST_DEBUG_OBJECT(pipeline(), "[Buffering] Restarting playback.");
                 changePipelineState(GST_STATE_PLAYING);
             }
         } else if (m_currentState == GST_STATE_PLAYING) {
-            m_paused = false;
+            m_isPaused = false;
 
-            if ((m_buffering && !isLiveStream()) || !m_playbackRate) {
+            if ((m_isBuffering && m_isLiveStream) || !m_playbackRate) {
                 GST_DEBUG_OBJECT(pipeline(), "[Buffering] Pausing stream for buffering.");
                 changePipelineState(GST_STATE_PAUSED);
             }
         } else
-            m_paused = true;
+            m_isPaused = true;
 
         GST_DEBUG_OBJECT(pipeline(), "Old state: %s, new state: %s (requested: %s)", gst_element_state_get_name(m_oldState), gst_element_state_get_name(m_currentState), gst_element_state_get_name(m_requestedState));
         if (m_requestedState == GST_STATE_PAUSED && m_currentState == GST_STATE_PAUSED) {
@@ -2637,24 +2633,24 @@ void MediaPlayerPrivateGStreamer::updateStates()
         break;
     case GST_STATE_CHANGE_FAILURE:
         GST_DEBUG_OBJECT(pipeline(), "Failure: State: %s, pending: %s", gst_element_state_get_name(m_currentState), gst_element_state_get_name(pending));
-        // Change failed
+        // Change failed.
         return;
     case GST_STATE_CHANGE_NO_PREROLL:
         GST_DEBUG_OBJECT(pipeline(), "No preroll: State: %s, pending: %s", gst_element_state_get_name(m_currentState), gst_element_state_get_name(pending));
 
         // Live pipelines go in PAUSED without prerolling.
-        m_isStreaming = true;
+        m_isLiveStream = true;
         updateDownloadBufferingFlag();
 
         if (m_currentState == GST_STATE_READY)
             m_readyState = MediaPlayer::HaveNothing;
         else if (m_currentState == GST_STATE_PAUSED) {
             m_readyState = MediaPlayer::HaveEnoughData;
-            m_paused = true;
+            m_isPaused = true;
         } else if (m_currentState == GST_STATE_PLAYING)
-            m_paused = false;
+            m_isPaused = false;
 
-        if (!m_paused && m_playbackRate)
+        if (!m_isPaused && m_playbackRate)
             changePipelineState(GST_STATE_PLAYING);
 
         m_networkState = MediaPlayer::Loading;
@@ -2680,11 +2676,11 @@ void MediaPlayerPrivateGStreamer::updateStates()
 
     if (getStateResult == GST_STATE_CHANGE_SUCCESS && m_currentState >= GST_STATE_PAUSED) {
         updatePlaybackRate();
-        if (m_seekIsPending) {
+        if (m_isSeekPending) {
             GST_DEBUG_OBJECT(pipeline(), "[Seek] committing pending seek to %s", toString(m_seekTime).utf8().data());
-            m_seekIsPending = false;
-            m_seeking = doSeek(m_seekTime, m_player->rate(), static_cast<GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE));
-            if (!m_seeking) {
+            m_isSeekPending = false;
+            m_isSeeking = doSeek(m_seekTime, m_player->rate(), static_cast<GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE));
+            if (!m_isSeeking) {
                 m_cachedPosition = MediaTime::invalidTime();
                 GST_DEBUG_OBJECT(pipeline(), "[Seek] seeking to %s failed", toString(m_seekTime).utf8().data());
             }
@@ -2718,7 +2714,7 @@ bool MediaPlayerPrivateGStreamer::loadNextLocation()
         return false;
 
     const GValue* locations = gst_structure_get_value(m_mediaLocations, "locations");
-    const gchar* newLocation = nullptr;
+    const char* newLocation = nullptr;
 
     if (!locations) {
         // Fallback on new-location string.
@@ -2775,7 +2771,7 @@ bool MediaPlayerPrivateGStreamer::loadNextLocation()
             m_player->readyStateChanged();
 
             // Reset pipeline state.
-            m_resetPipeline = true;
+            m_shouldResetPipeline = true;
 
             GstState state;
             gst_element_get_state(m_pipeline.get(), &state, nullptr, 0);
@@ -2801,7 +2797,7 @@ void MediaPlayerPrivateGStreamer::didEnd()
     // position is not always reported as 0 for instance.
     m_cachedPosition = MediaTime::invalidTime();
     MediaTime now = currentMediaTime();
-    if (now > MediaTime::zeroTime() && !m_seeking) {
+    if (now > MediaTime::zeroTime() && !m_isSeeking) {
         m_cachedDuration = now;
         m_player->durationChanged();
     }
@@ -2809,9 +2805,9 @@ void MediaPlayerPrivateGStreamer::didEnd()
     m_isEndReached = true;
 
     if (!m_player->client().mediaPlayerIsLooping()) {
-        m_paused = true;
+        m_isPaused = true;
         changePipelineState(GST_STATE_READY);
-        m_downloadFinished = false;
+        m_didDownloadFinish = false;
     }
     timeChanged();
 }
@@ -2864,12 +2860,12 @@ void MediaPlayerPrivateGStreamer::updateDownloadBufferingFlag()
     unsigned flagDownload = getGstPlayFlag("download");
 
     // We don't want to stop downloading if we already started it.
-    if (flags & flagDownload && m_readyState > MediaPlayer::HaveNothing && !m_resetPipeline) {
+    if (flags & flagDownload && m_readyState > MediaPlayer::HaveNothing && !m_shouldResetPipeline) {
         GST_DEBUG_OBJECT(pipeline(), "Download already started, not starting again");
         return;
     }
 
-    bool shouldDownload = !isLiveStream() && m_preload == MediaPlayer::Auto;
+    bool shouldDownload = !m_isLiveStream && m_preload == MediaPlayer::Auto;
     if (shouldDownload) {
         GST_INFO_OBJECT(pipeline(), "Enabling on-disk buffering");
         g_object_set(m_pipeline.get(), "flags", flags | flagDownload, nullptr);
@@ -2883,7 +2879,7 @@ void MediaPlayerPrivateGStreamer::updateDownloadBufferingFlag()
 
 void MediaPlayerPrivateGStreamer::createGSTPlayBin(const URL& url, const String& pipelineName)
 {
-    const gchar* playbinName = "playbin";
+    const char* playbinName = "playbin";
 
     // MSE doesn't support playbin3. Mediastream requires playbin3. Regular
     // playback can use playbin3 on-demand with the WEBKIT_GST_USE_PLAYBIN3
@@ -2906,8 +2902,6 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin(const URL& url, const String&
 
     m_isLegacyPlaybin = !g_strcmp0(playbinName, "playbin");
 
-    // gst_element_factory_make() returns a floating reference so
-    // we should not adopt.
     static Atomic<uint32_t> pipelineId;
     setPipeline(gst_element_factory_make(playbinName,
         (pipelineName.isEmpty() ? makeString("media-player-", pipelineId.exchangeAdd(1)) : pipelineName).utf8().data()));
@@ -2973,7 +2967,7 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin(const URL& url, const String&
 
     configurePlaySink();
 
-    if (m_preservesPitch) {
+    if (m_shouldPreservePitch) {
         GstElement* scale = gst_element_factory_make("scaletempo", nullptr);
 
         if (!scale)
@@ -2982,7 +2976,7 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin(const URL& url, const String&
             g_object_set(m_pipeline.get(), "audio-filter", scale, nullptr);
     }
 
-    if (!m_renderingCanBeAccelerated) {
+    if (!m_canRenderingBeAccelerated) {
         // If not using accelerated compositing, let GStreamer handle
         // the image-orientation tag.
         GstElement* videoFlip = gst_element_factory_make("videoflip", nullptr);
@@ -3007,7 +3001,7 @@ bool MediaPlayerPrivateGStreamer::didPassCORSAccessCheck() const
 
 bool MediaPlayerPrivateGStreamer::canSaveMediaData() const
 {
-    if (isLiveStream())
+    if (m_isLiveStream)
         return false;
 
     if (m_url.isLocalFile())
@@ -3027,7 +3021,7 @@ void MediaPlayerPrivateGStreamer::readyTimerFired()
 
 void MediaPlayerPrivateGStreamer::acceleratedRenderingStateChanged()
 {
-    m_renderingCanBeAccelerated = m_player && m_player->client().mediaPlayerAcceleratedCompositingEnabled();
+    m_canRenderingBeAccelerated = m_player && m_player->client().mediaPlayerAcceleratedCompositingEnabled();
 }
 
 #if USE(TEXTURE_MAPPER_GL)
@@ -3075,7 +3069,7 @@ void MediaPlayerPrivateGStreamer::pushTextureToCompositor()
             if (!proxy.isActive())
                 return;
 
-            std::unique_ptr<GstVideoFrameHolder> frameHolder = makeUnique<GstVideoFrameHolder>(m_sample.get(), m_videoDecoderPlatform, m_textureMapperFlags, !m_usingFallbackVideoSink);
+            std::unique_ptr<GstVideoFrameHolder> frameHolder = makeUnique<GstVideoFrameHolder>(m_sample.get(), m_videoDecoderPlatform, m_textureMapperFlags, !m_isUsingFallbackVideoSink);
 
             std::unique_ptr<TextureMapperPlatformLayerBuffer> layerBuffer;
             if (frameHolder->hasMappedTextures()) {
@@ -3117,23 +3111,23 @@ void MediaPlayerPrivateGStreamer::repaint()
 
 void MediaPlayerPrivateGStreamer::triggerRepaint(GstSample* sample)
 {
-    bool triggerResize;
+    bool shouldTriggerResize;
     {
         auto sampleLocker = holdLock(m_sampleMutex);
-        triggerResize = !m_sample;
+        shouldTriggerResize = !m_sample;
         m_sample = sample;
     }
 
-    if (triggerResize) {
+    if (shouldTriggerResize) {
         GST_DEBUG_OBJECT(pipeline(), "First sample reached the sink, triggering video dimensions update");
         m_notifier->notify(MainThreadNotification::SizeChanged, [this] {
             m_player->sizeChanged();
         });
     }
 
-    if (!m_renderingCanBeAccelerated) {
+    if (!m_canRenderingBeAccelerated) {
         LockHolder locker(m_drawMutex);
-        if (m_destroying)
+        if (m_isBeingDestroyed)
             return;
         m_drawTimer.startOneShot(0_s);
         m_drawCondition.wait(m_drawMutex);
@@ -3141,7 +3135,7 @@ void MediaPlayerPrivateGStreamer::triggerRepaint(GstSample* sample)
     }
 
 #if USE(TEXTURE_MAPPER_GL)
-    if (m_usingFallbackVideoSink) {
+    if (m_isUsingFallbackVideoSink) {
         LockHolder lock(m_drawMutex);
         auto proxyOperation =
             [this](TextureMapperPlatformLayerProxy& proxy)
@@ -3177,10 +3171,10 @@ void MediaPlayerPrivateGStreamer::cancelRepaint(bool destroying)
     //
     // This function is also used when destroying the player (destroying parameter is true), to release the gstreamer thread from
     // m_drawCondition and to ensure that new triggerRepaint calls won't wait on m_drawCondition.
-    if (!m_renderingCanBeAccelerated) {
+    if (!m_canRenderingBeAccelerated) {
         LockHolder locker(m_drawMutex);
         m_drawTimer.stop();
-        m_destroying = destroying;
+        m_isBeingDestroyed = destroying;
         m_drawCondition.notifyOne();
     }
 }
@@ -3262,9 +3256,9 @@ void MediaPlayerPrivateGStreamer::paint(GraphicsContext& context, const FloatRec
             m_colorConvertInputCaps = caps;
             m_colorConvertOutputCaps = adoptGRef(gst_caps_copy(caps));
 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
-            const gchar* formatString = GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? "RGBA" : "BGRx";
+            const char* formatString = GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? "RGBA" : "BGRx";
 #else
-            const gchar* formatString = GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? "RGBA" : "RGBx";
+            const char* formatString = GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? "RGBA" : "RGBx";
 #endif
             gst_caps_set_simple(m_colorConvertOutputCaps.get(), "format", G_TYPE_STRING, formatString, nullptr);
             if (!gst_gl_color_convert_set_caps(m_colorConvert.get(), caps, m_colorConvertOutputCaps.get()))
@@ -3285,7 +3279,7 @@ void MediaPlayerPrivateGStreamer::paint(GraphicsContext& context, const FloatRec
     if (!gstImage)
         return;
 
-    context.drawImage(gstImage->image(), rect, gstImage->rect(), { CompositeCopy, m_renderingCanBeAccelerated ? m_videoSourceOrientation : ImageOrientation() });
+    context.drawImage(gstImage->image(), rect, gstImage->rect(), { CompositeCopy, m_canRenderingBeAccelerated ? m_videoSourceOrientation : ImageOrientation() });
 }
 
 #if USE(GSTREAMER_GL)
@@ -3293,7 +3287,7 @@ bool MediaPlayerPrivateGStreamer::copyVideoTextureToPlatformTexture(GraphicsCont
 {
     UNUSED_PARAM(context);
 
-    if (m_usingFallbackVideoSink)
+    if (m_isUsingFallbackVideoSink)
         return false;
 
     if (premultiplyAlpha)
@@ -3325,7 +3319,7 @@ bool MediaPlayerPrivateGStreamer::copyVideoTextureToPlatformTexture(GraphicsCont
 NativeImagePtr MediaPlayerPrivateGStreamer::nativeImageForCurrentTime()
 {
 #if USE(CAIRO) && ENABLE(ACCELERATED_2D_CANVAS)
-    if (m_usingFallbackVideoSink)
+    if (m_isUsingFallbackVideoSink)
         return nullptr;
 
     auto sampleLocker = holdLock(m_sampleMutex);
@@ -3406,7 +3400,7 @@ MediaPlayer::MovieLoadType MediaPlayerPrivateGStreamer::movieLoadType() const
     if (m_readyState == MediaPlayer::HaveNothing)
         return MediaPlayer::Unknown;
 
-    if (isLiveStream())
+    if (m_isLiveStream)
         return MediaPlayer::LiveStream;
 
     return MediaPlayer::Download;
@@ -3484,12 +3478,12 @@ GstElement* MediaPlayerPrivateGStreamer::createVideoSink()
 #endif
 
 #if USE(GSTREAMER_GL)
-    if (m_renderingCanBeAccelerated)
+    if (m_canRenderingBeAccelerated)
         m_videoSink = createVideoSinkGL();
 #endif
 
     if (!m_videoSink) {
-        m_usingFallbackVideoSink = true;
+        m_isUsingFallbackVideoSink = true;
         m_videoSink = webkitVideoSinkNew();
         g_signal_connect_swapped(m_videoSink.get(), "repaint-requested", G_CALLBACK(repaintCallback), this);
         g_signal_connect_swapped(m_videoSink.get(), "repaint-cancelled", G_CALLBACK(repaintCancelledCallback), this);
@@ -3543,7 +3537,7 @@ void MediaPlayerPrivateGStreamer::setStreamVolumeElement(GstStreamVolume* volume
 
 unsigned MediaPlayerPrivateGStreamer::decodedFrameCount() const
 {
-    guint64 decodedFrames = 0;
+    uint64_t decodedFrames = 0;
     if (m_fpsSink)
         g_object_get(m_fpsSink.get(), "frames-rendered", &decodedFrames, nullptr);
     return static_cast<unsigned>(decodedFrames);
@@ -3551,7 +3545,7 @@ unsigned MediaPlayerPrivateGStreamer::decodedFrameCount() const
 
 unsigned MediaPlayerPrivateGStreamer::droppedFrameCount() const
 {
-    guint64 framesDropped = 0;
+    uint64_t framesDropped = 0;
     if (m_fpsSink)
         g_object_get(m_fpsSink.get(), "frames-dropped", &framesDropped, nullptr);
     return static_cast<unsigned>(framesDropped);
@@ -3649,8 +3643,8 @@ void MediaPlayerPrivateGStreamer::attemptToDecryptWithInstance(CDMInstance& inst
 
 void MediaPlayerPrivateGStreamer::attemptToDecryptWithLocalInstance()
 {
-    bool eventHandled = gst_element_send_event(pipeline(), gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM_OOB, gst_structure_new_empty("attempt-to-decrypt")));
-    GST_DEBUG("attempting to decrypt, event handled %s", boolForPrinting(eventHandled));
+    bool wasEventHandled = gst_element_send_event(pipeline(), gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM_OOB, gst_structure_new_empty("attempt-to-decrypt")));
+    GST_DEBUG("attempting to decrypt, event handled %s", boolForPrinting(wasEventHandled));
 }
 
 void MediaPlayerPrivateGStreamer::handleProtectionEvent(GstEvent* event)
@@ -3669,15 +3663,15 @@ void MediaPlayerPrivateGStreamer::handleProtectionEvent(GstEvent* event)
     initializationDataEncountered({eventKeySystemUUID, initData});
 }
 
-void MediaPlayerPrivateGStreamer::setWaitingForKey(bool waitingForKey)
+void MediaPlayerPrivateGStreamer::setWaitingForKey(bool isWaitingForKey)
 {
     // We bail out if values did not change or if we are requested to not wait anymore but there are still waiting decryptors.
-    GST_TRACE("waitingForKey %s, m_waitingForKey %s", boolForPrinting(waitingForKey), boolForPrinting(m_waitingForKey));
-    if (waitingForKey == m_waitingForKey || (!waitingForKey && this->waitingForKey()))
+    GST_TRACE("isWaitingForKey %s, m_isWaitingForKey %s", boolForPrinting(isWaitingForKey), boolForPrinting(m_isWaitingForKey));
+    if (isWaitingForKey == m_isWaitingForKey || (!isWaitingForKey && this->waitingForKey()))
         return;
 
-    m_waitingForKey = waitingForKey;
-    GST_DEBUG("waiting for key changed %s", boolForPrinting(m_waitingForKey));
+    m_isWaitingForKey = isWaitingForKey;
+    GST_DEBUG("waiting for key changed %s", boolForPrinting(m_isWaitingForKey));
     m_player->waitingForKeyChanged();
 }
 
index 2790ec3..2ca86d4 100644 (file)
@@ -120,17 +120,14 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface, public C
 {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static void initializeDebugCategory();
-
     MediaPlayerPrivateGStreamer(MediaPlayer*);
     virtual ~MediaPlayerPrivateGStreamer();
 
-    static bool isAvailable();
     static void registerMediaEngine(MediaEngineRegistrar);
+    static MediaPlayer::SupportsType extendedSupportsType(const MediaEngineSupportParameters&, MediaPlayer::SupportsType);
 
-    bool hasVideo() const override { return m_hasVideo; }
-    bool hasAudio() const override { return m_hasAudio; }
-
+    bool hasVideo() const final { return m_hasVideo; }
+    bool hasAudio() const final { return m_hasAudio; }
     void load(const String &url) override;
 #if ENABLE(MEDIA_SOURCE)
     void load(const String& url, MediaSourcePrivateClient*) override;
@@ -138,81 +135,57 @@ public:
 #if ENABLE(MEDIA_STREAM)
     void load(MediaStreamPrivate&) override;
 #endif
-    void commitLoad();
-    void cancelLoad() override;
-
-    void prepareToPlay() override;
-    void play() override;
+    void cancelLoad() final;
+    void prepareToPlay() final;
+    void play() final;
     void pause() override;
-    bool paused() const override;
-    bool seeking() const override { return m_seeking; }
+    bool paused() const final;
+    bool seeking() const override { return m_isSeeking; }
     void seek(const MediaTime&) override;
-
-    MediaTime platformDuration() const;
-
     void setRate(float) override;
-    double rate() const override;
-    void setPreservesPitch(bool) override;
-    void setPreload(MediaPlayer::Preload) override;
-
+    double rate() const final;
+    void setPreservesPitch(bool) final; 
+    void setPreload(MediaPlayer::Preload) final;
     FloatSize naturalSize() const final;
-
-    void setVolume(float) override;
-    float volume() const override;
-
-    void setMuted(bool) override;
-    bool muted() const;
-
-    MediaPlayer::NetworkState networkState() const override;
-    MediaPlayer::ReadyState readyState() const override;
-
-    void setVisible(bool) override { }
-    void setSize(const IntSize&) override;
-    void sizeChanged();
-
+    void setVolume(float) final;
+    float volume() const final;
+    void setMuted(bool) final;
+    MediaPlayer::NetworkState networkState() const final;
+    MediaPlayer::ReadyState readyState() const final;
+    void setVisible(bool) final { }
+    void setSize(const IntSize&) final;
     // Prefer MediaTime based methods over float based.
-
-    float duration() const override { return durationMediaTime().toFloat(); }
-    double durationDouble() const override { return durationMediaTime().toDouble(); }
-    MediaTime durationMediaTime() const override;
-    float currentTime() const override { return currentMediaTime().toFloat(); }
-    double currentTimeDouble() const override { return currentMediaTime().toDouble(); }
+    float duration() const final { return durationMediaTime().toFloat(); }
+    double durationDouble() const final { return durationMediaTime().toDouble(); }
+    MediaTime durationMediaTime() const;
+    float currentTime() const final { return currentMediaTime().toFloat(); }
+    double currentTimeDouble() const final { return currentMediaTime().toDouble(); }
     MediaTime currentMediaTime() const override;
     std::unique_ptr<PlatformTimeRanges> buffered() const override;
-    void seek(float time) override { seek(MediaTime::createWithFloat(time)); }
-    void seekDouble(double time) override { seek(MediaTime::createWithDouble(time)); }
-
-    float maxTimeSeekable() const override { return maxMediaTimeSeekable().toFloat(); }
+    void seek(float time) final { seek(MediaTime::createWithFloat(time)); }
+    void seekDouble(double time) final { seek(MediaTime::createWithDouble(time)); }
+    float maxTimeSeekable() const final { return maxMediaTimeSeekable().toFloat(); }
     MediaTime maxMediaTimeSeekable() const override;
-    double minTimeSeekable() const override { return minMediaTimeSeekable().toFloat(); }
-    MediaTime minMediaTimeSeekable() const override { return MediaTime::zeroTime(); }
-
-    bool didLoadingProgress() const override;
-    unsigned long long totalBytes() const override;
-
-    bool hasSingleSecurityOrigin() const override;
-    Optional<bool> wouldTaintOrigin(const SecurityOrigin&) const override;
-
-    void simulateAudioInterruption() override;
-
+    double minTimeSeekable() const final { return minMediaTimeSeekable().toFloat(); }
+    MediaTime minMediaTimeSeekable() const final { return MediaTime::zeroTime(); }
+    bool didLoadingProgress() const final;
+    unsigned long long totalBytes() const final;
+    bool hasSingleSecurityOrigin() const final;
+    Optional<bool> wouldTaintOrigin(const SecurityOrigin&) const final;
+    void simulateAudioInterruption() final;
 #if ENABLE(WEB_AUDIO)
-    AudioSourceProvider* audioSourceProvider() override;
+    AudioSourceProvider* audioSourceProvider() final;
 #endif
+    void paint(GraphicsContext&, const FloatRect&) final;
+    bool supportsFullscreen() const final;
+    MediaPlayer::MovieLoadType movieLoadType() const final;
 
-    void paint(GraphicsContext&, const FloatRect&) override;
+    unsigned decodedFrameCount() const final;
+    unsigned droppedFrameCount() const final;
+    unsigned audioDecodedByteCount() const final;
+    unsigned videoDecodedByteCount() const final;
 
-    bool supportsFullscreen() const override;
-
-    MediaPlayer::MovieLoadType movieLoadType() const override;
-
-    MediaPlayer* mediaPlayer() const { return m_player; }
-
-    unsigned decodedFrameCount() const override;
-    unsigned droppedFrameCount() const override;
-    unsigned audioDecodedByteCount() const override;
-    unsigned videoDecodedByteCount() const override;
-
-    void acceleratedRenderingStateChanged() override;
+    void acceleratedRenderingStateChanged() final;
 
 #if USE(TEXTURE_MAPPER_GL)
     PlatformLayer* platformLayer() const override;
@@ -225,29 +198,23 @@ public:
 #endif
 
 #if ENABLE(ENCRYPTED_MEDIA)
-    void cdmInstanceAttached(CDMInstance&) override;
-    void cdmInstanceDetached(CDMInstance&) override;
-    void handleProtectionEvent(GstEvent*);
-    virtual void attemptToDecryptWithLocalInstance();
+    void cdmInstanceAttached(CDMInstance&) final;
+    void cdmInstanceDetached(CDMInstance&) final;
     void attemptToDecryptWithInstance(CDMInstance&) final;
-    void initializationDataEncountered(InitData&&);
-    void setWaitingForKey(bool);
-    bool waitingForKey() const override;
-#endif
+    bool waitingForKey() const final;
 
-    static bool supportsKeySystem(const String& keySystem, const String& mimeType);
-    static MediaPlayer::SupportsType extendedSupportsType(const MediaEngineSupportParameters&, MediaPlayer::SupportsType);
+    void handleProtectionEvent(GstEvent*);
+#endif
 
 #if USE(GSTREAMER_GL)
     bool copyVideoTextureToPlatformTexture(GraphicsContext3D*, Platform3DObject, GC3Denum, GC3Dint, GC3Denum, GC3Denum, GC3Denum, bool, bool) override;
     NativeImagePtr nativeImageForCurrentTime() override;
 #endif
 
-    void setVideoSourceOrientation(ImageOrientation);
-    GstElement* pipeline() const { return m_pipeline.get(); }
     void enableTrack(TrackPrivateBaseGStreamer::TrackType, unsigned index);
 
     // Append pipeline interface
+    // FIXME: Use the client interface pattern, AppendPipeline does not need the full interface to this class just for these two functions.
     bool handleSyncMessage(GstMessage*);
     void handleMessage(GstMessage*);
 
@@ -270,15 +237,16 @@ protected:
         StreamCollectionChanged = 1 << 7
     };
 
-    virtual bool isLiveStream() const { return m_isStreaming; }
-    MediaTime maxTimeLoaded() const;
+    static bool isAvailable();
+#if ENABLE(ENCRYPTED_MEDIA)
+    static bool supportsKeySystem(const String& keySystem, const String& mimeType);
+#endif
 
     virtual void durationChanged();
     virtual void sourceSetup(GstElement*);
     virtual void configurePlaySink() { }
     virtual bool changePipelineState(GstState);
 
-
 #if USE(GSTREAMER_HOLEPUNCH)
     GstElement* createHolePunchVideoSink();
     void pushNextHolePunchBuffer();
@@ -292,10 +260,10 @@ protected:
 #if USE(TEXTURE_MAPPER_GL)
     void pushTextureToCompositor();
 #if USE(NICOSIA)
-    void swapBuffersIfNeeded() override;
+    void swapBuffersIfNeeded() final;
 #else
-    RefPtr<TextureMapperPlatformLayerProxy> proxy() const override;
-    void swapBuffersIfNeeded() override;
+    RefPtr<TextureMapperPlatformLayerProxy> proxy() const final;
+    void swapBuffersIfNeeded() final;
 #endif
 #endif
 
@@ -317,9 +285,6 @@ protected:
     static void volumeChangedCallback(MediaPlayerPrivateGStreamer*);
     static void muteChangedCallback(MediaPlayerPrivateGStreamer*);
 
-    // FIXME: Where is this used?
-    void handlePluginInstallerResult(GstInstallPluginsReturn);
-
     void readyTimerFired();
 
     void notifyPlayerOfVideo();
@@ -358,22 +323,22 @@ protected:
     mutable MediaTime m_cachedPosition;
     mutable MediaTime m_cachedDuration;
     bool m_canFallBackToLastFinishedSeekPosition { false };
-    bool m_changingRate { false };
-    bool m_downloadFinished { false };
-    bool m_errorOccured { false };
+    bool m_isChangingRate { false };
+    bool m_didDownloadFinish { false };
+    bool m_didErrorOccur { false };
     mutable bool m_isEndReached { false };
-    mutable bool m_isStreaming { false };
-    bool m_paused { true };
+    mutable bool m_isLiveStream { false };
+    bool m_isPaused { true };
     float m_playbackRate { 1 };
     GstState m_currentState;
     GstState m_oldState;
     GstState m_requestedState { GST_STATE_VOID_PENDING };
-    bool m_resetPipeline { false };
-    bool m_seeking { false };
-    bool m_seekIsPending { false };
+    bool m_shouldResetPipeline { false };
+    bool m_isSeeking { false };
+    bool m_isSeekPending { false };
     MediaTime m_seekTime;
     GRefPtr<GstElement> m_source { nullptr };
-    bool m_volumeAndMuteInitialized { false };
+    bool m_areVolumeAndMuteInitialized { false };
 
 #if USE(TEXTURE_MAPPER_GL)
     TextureMapperGL::Flags m_textureMapperFlags;
@@ -391,10 +356,10 @@ protected:
     GRefPtr<GstSample> m_sample;
 
     mutable FloatSize m_videoSize;
-    bool m_usingFallbackVideoSink { false };
-    bool m_renderingCanBeAccelerated { false };
+    bool m_isUsingFallbackVideoSink { false };
+    bool m_canRenderingBeAccelerated { false };
 
-    bool m_destroying { false };
+    bool m_isBeingDestroyed { false };
 
 #if USE(GSTREAMER_GL)
     std::unique_ptr<VideoTextureCopierGStreamer> m_videoTextureCopier;
@@ -412,17 +377,21 @@ protected:
     Lock m_protectionMutex; // Guards access to m_handledProtectionEvents.
     HashSet<uint32_t> m_handledProtectionEvents;
 
-    bool m_waitingForKey { false };
+    bool m_isWaitingForKey { false };
 #endif
 
     Optional<GstVideoDecoderPlatform> m_videoDecoderPlatform;
 
 private:
+    MediaTime maxTimeLoaded() const;
+    GstElement* pipeline() const { return m_pipeline.get(); }
+    void setVideoSourceOrientation(ImageOrientation);
+    MediaTime platformDuration() const;
+    bool isMuted() const;
+    void commitLoad();
     void fillTimerFired();
-
     void didEnd();
 
-
     GstElement* createVideoSink();
     GstElement* createAudioSink();
     GstElement* audioSink() const;
@@ -475,20 +444,26 @@ private:
     void updateTracks();
     void clearTracks();
 
+#if ENABLE(ENCRYPTED_MEDIA)
+    void attemptToDecryptWithLocalInstance();
+    void initializationDataEncountered(InitData&&);
+    void setWaitingForKey(bool);
+#endif
+
 #if ENABLE(VIDEO_TRACK)
     GRefPtr<GstElement> m_textAppSink;
     GRefPtr<GstPad> m_textAppSinkPad;
 #endif
     GstStructure* m_mediaLocations { nullptr };
     int m_mediaLocationCurrentIndex { 0 };
-    bool m_playbackRatePause { false };
+    bool m_isPlaybackRatePaused { false };
     MediaTime m_timeOfOverlappingSeek;
     float m_lastPlaybackRate { 1 };
     Timer m_fillTimer;
     MediaTime m_maxTimeLoaded;
     bool m_loadingStalled { false };
     MediaPlayer::Preload m_preload;
-    bool m_delayingLoad { false };
+    bool m_isDelayingLoad { false };
     mutable MediaTime m_maxTimeLoadedAtLastDidLoadingProgress;
     bool m_hasVideo { false };
     bool m_hasAudio { false };
@@ -503,11 +478,11 @@ private:
     RefPtr<TextureMapperPlatformLayerProxy> m_platformLayerProxy;
 #endif
 #endif
-    bool m_buffering { false };
+    bool m_isBuffering { false };
     int m_bufferingPercentage { 0 };
     mutable unsigned long long m_totalBytes { 0 };
     URL m_url;
-    bool m_preservesPitch { false };
+    bool m_shouldPreservePitch { false };
     mutable Optional<Seconds> m_lastQueryTime;
     bool m_isLegacyPlaybin;
     GRefPtr<GstStreamCollection> m_streamCollection;
index e6880d9..dc245b4 100644 (file)
@@ -132,13 +132,14 @@ void MediaPlayerPrivateGStreamerMSE::load(const String& url, MediaSourcePrivateC
 
 void MediaPlayerPrivateGStreamerMSE::pause()
 {
-    m_paused = true;
+    // FIXME: Should not need direct access to this member. This override is probably not needed.
+    m_isPaused = true;
     MediaPlayerPrivateGStreamer::pause();
 }
 
 MediaTime MediaPlayerPrivateGStreamerMSE::durationMediaTime() const
 {
-    if (UNLIKELY(!m_pipeline || m_errorOccured))
+    if (UNLIKELY(!m_pipeline || m_didErrorOccur))
         return MediaTime();
 
     return m_mediaTimeDuration;
@@ -146,7 +147,7 @@ MediaTime MediaPlayerPrivateGStreamerMSE::durationMediaTime() const
 
 void MediaPlayerPrivateGStreamerMSE::seek(const MediaTime& time)
 {
-    if (UNLIKELY(!m_pipeline || m_errorOccured))
+    if (UNLIKELY(!m_pipeline || m_didErrorOccur))
         return;
 
     GST_INFO("[Seek] seek attempt to %s secs", toString(time).utf8().data());
@@ -154,15 +155,15 @@ void MediaPlayerPrivateGStreamerMSE::seek(const MediaTime& time)
     // Avoid useless seeking.
     MediaTime current = currentMediaTime();
     if (time == current) {
-        if (!m_seeking)
+        if (!m_isSeeking)
             timeChanged();
         return;
     }
 
-    if (isLiveStream())
+    if (m_isLiveStream)
         return;
 
-    if (m_seeking && m_seekIsPending) {
+    if (m_isSeeking && m_isSeekPending) {
         m_seekTime = time;
         return;
     }
@@ -179,7 +180,7 @@ void MediaPlayerPrivateGStreamerMSE::seek(const MediaTime& time)
     }
 
     m_isEndReached = false;
-    GST_DEBUG("m_seeking=%s, m_seekTime=%s", boolForPrinting(m_seeking), toString(m_seekTime).utf8().data());
+    GST_DEBUG("m_isSeeking=%s, m_seekTime=%s", boolForPrinting(m_isSeeking), toString(m_seekTime).utf8().data());
 }
 
 void MediaPlayerPrivateGStreamerMSE::configurePlaySink()
@@ -232,7 +233,7 @@ bool MediaPlayerPrivateGStreamerMSE::doSeek()
     GstSeekFlags seekType = static_cast<GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE);
 
     // Always move to seeking state to report correct 'currentTime' while pending for actual seek to complete.
-    m_seeking = true;
+    m_isSeeking = true;
 
     // Check if playback pipeline is ready for seek.
     GstState state, newState;
@@ -240,7 +241,7 @@ bool MediaPlayerPrivateGStreamerMSE::doSeek()
     if (getStateResult == GST_STATE_CHANGE_FAILURE || getStateResult == GST_STATE_CHANGE_NO_PREROLL) {
         GST_DEBUG("[Seek] cannot seek, current state change is %s", gst_element_state_change_return_get_name(getStateResult));
         webKitMediaSrcSetReadyForSamples(WEBKIT_MEDIA_SRC(m_source.get()), true);
-        m_seeking = false;
+        m_isSeeking = false;
         return false;
     }
     if ((getStateResult == GST_STATE_CHANGE_ASYNC
@@ -262,19 +263,19 @@ bool MediaPlayerPrivateGStreamerMSE::doSeek()
 
         GST_DEBUG("[Seek] Delaying the seek: %s", reason.data());
 
-        m_seekIsPending = true;
+        m_isSeekPending = true;
 
         if (m_isEndReached) {
             GST_DEBUG("[Seek] reset pipeline");
-            m_resetPipeline = true;
-            m_seeking = false;
+            m_shouldResetPipeline = true;
+            m_isSeeking = false;
             if (!changePipelineState(GST_STATE_PAUSED))
                 loadingFailed(MediaPlayer::Empty);
             else
-                m_seeking = true;
+                m_isSeeking = true;
         }
 
-        return m_seeking;
+        return m_isSeeking;
     }
 
     // Stop accepting new samples until actual seek is finished.
@@ -300,7 +301,7 @@ bool MediaPlayerPrivateGStreamerMSE::doSeek()
         if (setStateResult == GST_STATE_CHANGE_FAILURE) {
             GST_DEBUG("[Seek] Cannot seek, failed to pause playback pipeline.");
             webKitMediaSrcSetReadyForSamples(WEBKIT_MEDIA_SRC(m_source.get()), true);
-            m_seeking = false;
+            m_isSeeking = false;
             return false;
         }
         m_readyState = MediaPlayer::HaveMetadata;
@@ -314,7 +315,7 @@ bool MediaPlayerPrivateGStreamerMSE::doSeek()
         m_mediaSource->monitorSourceBuffers();
         ASSERT(m_mseSeekCompleted);
         // Note: seekCompleted will recursively call us.
-        return m_seeking;
+        return m_isSeeking;
     }
 
     GST_DEBUG("We can seek now");
@@ -337,7 +338,7 @@ bool MediaPlayerPrivateGStreamerMSE::doSeek()
     m_gstSeekCompleted = false;
     if (!gst_element_seek(m_pipeline.get(), rate, GST_FORMAT_TIME, seekType, GST_SEEK_TYPE_SET, toGstClockTime(startTime), GST_SEEK_TYPE_SET, toGstClockTime(endTime))) {
         webKitMediaSrcSetReadyForSamples(WEBKIT_MEDIA_SRC(m_source.get()), true);
-        m_seeking = false;
+        m_isSeeking = false;
         m_gstSeekCompleted = true;
         GST_DEBUG("doSeek(): gst_element_seek() failed, returning false");
         return false;
@@ -350,7 +351,7 @@ bool MediaPlayerPrivateGStreamerMSE::doSeek()
 
 void MediaPlayerPrivateGStreamerMSE::maybeFinishSeek()
 {
-    if (!m_seeking || !m_mseSeekCompleted || !m_gstSeekCompleted)
+    if (!m_isSeeking || !m_mseSeekCompleted || !m_gstSeekCompleted)
         return;
 
     GstState state, newState;
@@ -362,9 +363,9 @@ void MediaPlayerPrivateGStreamerMSE::maybeFinishSeek()
         return;
     }
 
-    if (m_seekIsPending) {
+    if (m_isSeekPending) {
         GST_DEBUG("[Seek] Committing pending seek to %s", toString(m_seekTime).utf8().data());
-        m_seekIsPending = false;
+        m_isSeekPending = false;
         if (!doSeek()) {
             GST_WARNING("[Seek] Seeking to %s failed", toString(m_seekTime).utf8().data());
             m_cachedPosition = MediaTime::invalidTime();
@@ -375,7 +376,7 @@ void MediaPlayerPrivateGStreamerMSE::maybeFinishSeek()
     GST_DEBUG("[Seek] Seeked to %s", toString(m_seekTime).utf8().data());
 
     webKitMediaSrcSetReadyForSamples(WEBKIT_MEDIA_SRC(m_source.get()), true);
-    m_seeking = false;
+    m_isSeeking = false;
     m_cachedPosition = MediaTime::invalidTime();
     // The pipeline can still have a pending state. In this case a position query will fail.
     // Right now we can use m_seekTime as a fallback.
@@ -390,7 +391,7 @@ void MediaPlayerPrivateGStreamerMSE::updatePlaybackRate()
 
 bool MediaPlayerPrivateGStreamerMSE::seeking() const
 {
-    return m_seeking;
+    return m_isSeeking;
 }
 
 // FIXME: MediaPlayerPrivateGStreamer manages the ReadyState on its own. We shouldn't change it manually.
@@ -428,7 +429,7 @@ void MediaPlayerPrivateGStreamerMSE::setReadyState(MediaPlayer::ReadyState ready
 
 void MediaPlayerPrivateGStreamerMSE::waitForSeekCompleted()
 {
-    if (!m_seeking)
+    if (!m_isSeeking)
         return;
 
     GST_DEBUG("Waiting for MSE seek completed");
@@ -479,7 +480,7 @@ void MediaPlayerPrivateGStreamerMSE::sourceSetup(GstElement* sourceElement)
 
 void MediaPlayerPrivateGStreamerMSE::updateStates()
 {
-    if (UNLIKELY(!m_pipeline || m_errorOccured))
+    if (UNLIKELY(!m_pipeline || m_didErrorOccur))
         return;
 
     MediaPlayer::NetworkState oldNetworkState = m_networkState;
@@ -498,8 +499,8 @@ void MediaPlayerPrivateGStreamerMSE::updateStates()
         if (m_isEndReached && state == GST_STATE_READY)
             break;
 
-        m_resetPipeline = (state <= GST_STATE_READY);
-        if (m_resetPipeline)
+        m_shouldResetPipeline = (state <= GST_STATE_READY);
+        if (m_shouldResetPipeline)
             m_mediaTimeDuration = MediaTime::zeroTime();
 
         // Update ready and network states.
@@ -538,25 +539,25 @@ void MediaPlayerPrivateGStreamerMSE::updateStates()
 
         // Sync states where needed.
         if (state == GST_STATE_PAUSED) {
-            if (!m_volumeAndMuteInitialized) {
+            if (!m_areVolumeAndMuteInitialized) {
                 notifyPlayerOfVolumeChange();
                 notifyPlayerOfMute();
-                m_volumeAndMuteInitialized = true;
+                m_areVolumeAndMuteInitialized = true;
             }
 
-            if (!seeking() && !m_paused && m_playbackRate) {
+            if (!seeking() && !m_isPaused && m_playbackRate) {
                 GST_DEBUG("[Buffering] Restarting playback.");
                 changePipelineState(GST_STATE_PLAYING);
             }
         } else if (state == GST_STATE_PLAYING) {
-            m_paused = false;
+            m_isPaused = false;
 
             if (!m_playbackRate) {
                 GST_DEBUG("[Buffering] Pausing stream for buffering.");
                 changePipelineState(GST_STATE_PAUSED);
             }
         } else
-            m_paused = true;
+            m_isPaused = true;
 
         if (m_requestedState == GST_STATE_PAUSED && state == GST_STATE_PAUSED) {
             shouldUpdatePlaybackState = true;
@@ -577,7 +578,7 @@ void MediaPlayerPrivateGStreamerMSE::updateStates()
         GST_DEBUG("No preroll: State: %s, pending: %s", gst_element_state_get_name(state), gst_element_state_get_name(pending));
 
         // Live pipelines go in PAUSED without prerolling.
-        m_isStreaming = true;
+        m_isLiveStream = true;
 
         if (state == GST_STATE_READY) {
             m_readyState = MediaPlayer::HaveNothing;
@@ -585,11 +586,11 @@ void MediaPlayerPrivateGStreamerMSE::updateStates()
         } else if (state == GST_STATE_PAUSED) {
             m_readyState = MediaPlayer::HaveEnoughData;
             GST_DEBUG("m_readyState=%s", dumpReadyState(m_readyState));
-            m_paused = true;
+            m_isPaused = true;
         } else if (state == GST_STATE_PLAYING)
-            m_paused = false;
+            m_isPaused = false;
 
-        if (!m_paused && m_playbackRate)
+        if (!m_isPaused && m_playbackRate)
             changePipelineState(GST_STATE_PLAYING);
 
         m_networkState = MediaPlayer::Loading;
@@ -620,10 +621,10 @@ void MediaPlayerPrivateGStreamerMSE::updateStates()
 }
 void MediaPlayerPrivateGStreamerMSE::asyncStateChangeDone()
 {
-    if (UNLIKELY(!m_pipeline || m_errorOccured))
+    if (UNLIKELY(!m_pipeline || m_didErrorOccur))
         return;
 
-    if (m_seeking)
+    if (m_isSeeking)
         maybeFinishSeek();
     else
         updateStates();
@@ -774,7 +775,7 @@ MediaTime MediaPlayerPrivateGStreamerMSE::currentMediaTime() const
 
 MediaTime MediaPlayerPrivateGStreamerMSE::maxMediaTimeSeekable() const
 {
-    if (UNLIKELY(m_errorOccured))
+    if (UNLIKELY(m_didErrorOccur))
         return MediaTime::zeroTime();
 
     GST_DEBUG("maxMediaTimeSeekable");
index 3bcc0fd..9b33305 100644 (file)
@@ -54,7 +54,6 @@ public:
 
     void updateDownloadBufferingFlag() override { };
 
-    bool isLiveStream() const override { return false; }
     MediaTime currentMediaTime() const override;
 
     void pause() override;
index fae74f4..c097ca3 100644 (file)
@@ -163,7 +163,8 @@ void MediaSourceClientGStreamerMSE::flush(AtomString trackId)
     ASSERT(WTF::isMainThread());
 
     // This is only for on-the-fly reenqueues after appends. When seeking, the seek will do its own flush.
-    if (!m_playerPrivate.m_seeking)
+    // FIXME: Should not be touching private parts.
+    if (!m_playerPrivate.m_isSeeking)
         m_playerPrivate.m_playbackPipeline->flush(trackId);
 }