Skip to content

Commit

Permalink
Merge r155104 - [Qt][WK1] REGRESSION(r154988): compositing/video/vide…
Browse files Browse the repository at this point in the history
…o-with-invalid-source.html

https://bugs.webkit.org/show_bug.cgi?id=120683

Patch by Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk> on 2013-09-05
Reviewed by Philippe Normand.

Do not set pipeline state to NULL on MediaPlayerPrivateGStreamer::loadingFailed()
otherwise the bus is flushed and we never get a GST_MESSAGE_ERROR when failing to
load uris.
Also restore previous behaviour (before r154988) of not invoking loadingFailed() for
all failed manual state change attempts.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
Do not call loadingFailed() if state change fails as all manual state changes are
now done with changePipelineState().
(WebCore::MediaPlayerPrivateGStreamer::play):
(WebCore::MediaPlayerPrivateGStreamer::pause):
(WebCore::MediaPlayerPrivateGStreamer::seek):
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):
Restore previous behaviour (before changeset r154988) when calling changePipelineState().
(WebCore::MediaPlayerPrivateGStreamer::updateStates):
Do nothing if changing to READY on EOS (same behaviour as setting to NULL as it was before
changeset r154988).
(WebCore::MediaPlayerPrivateGStreamer::loadingFailed):
Do not set pipeline state to NULL so we properly get GST_MESSAGE_ERROR on loading failures.
  • Loading branch information
andrunko authored and carlosgcampos committed Sep 9, 2013
1 parent c7acf38 commit 81c5857
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
28 changes: 28 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,31 @@
2013-09-05 Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk>

[Qt][WK1] REGRESSION(r154988): compositing/video/video-with-invalid-source.html
https://bugs.webkit.org/show_bug.cgi?id=120683

Reviewed by Philippe Normand.

Do not set pipeline state to NULL on MediaPlayerPrivateGStreamer::loadingFailed()
otherwise the bus is flushed and we never get a GST_MESSAGE_ERROR when failing to
load uris.
Also restore previous behaviour (before r154988) of not invoking loadingFailed() for
all failed manual state change attempts.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
Do not call loadingFailed() if state change fails as all manual state changes are
now done with changePipelineState().
(WebCore::MediaPlayerPrivateGStreamer::play):
(WebCore::MediaPlayerPrivateGStreamer::pause):
(WebCore::MediaPlayerPrivateGStreamer::seek):
(WebCore::MediaPlayerPrivateGStreamer::handleMessage):
Restore previous behaviour (before changeset r154988) when calling changePipelineState().
(WebCore::MediaPlayerPrivateGStreamer::updateStates):
Do nothing if changing to READY on EOS (same behaviour as setting to NULL as it was before
changeset r154988).
(WebCore::MediaPlayerPrivateGStreamer::loadingFailed):
Do not set pipeline state to NULL so we properly get GST_MESSAGE_ERROR on loading failures.

2013-09-03 Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk>

[GStreamer] Don't set state to NULL until element is destroyed
Expand Down
Expand Up @@ -403,7 +403,6 @@ bool MediaPlayerPrivateGStreamer::changePipelineState(GstState newState)
GstStateChangeReturn setStateResult = gst_element_set_state(m_playBin.get(), newState);
GstState pausedOrPlaying = newState == GST_STATE_PLAYING ? GST_STATE_PAUSED : GST_STATE_PLAYING;
if (currentState != pausedOrPlaying && setStateResult == GST_STATE_CHANGE_FAILURE) {
loadingFailed(MediaPlayer::Empty);
return false;
}

Expand Down Expand Up @@ -438,6 +437,8 @@ void MediaPlayerPrivateGStreamer::play()
m_preload = MediaPlayer::Auto;
setDownloadBuffering();
LOG_MEDIA_MESSAGE("Play");
} else {
loadingFailed(MediaPlayer::Empty);
}
}

Expand All @@ -450,6 +451,8 @@ void MediaPlayerPrivateGStreamer::pause()

if (changePipelineState(GST_STATE_PAUSED))
INFO_MEDIA_MESSAGE("Pause");
else
loadingFailed(MediaPlayer::Empty);
}

float MediaPlayerPrivateGStreamer::duration() const
Expand Down Expand Up @@ -548,7 +551,8 @@ void MediaPlayerPrivateGStreamer::seek(float time)
if (m_isEndReached) {
LOG_MEDIA_MESSAGE("[Seek] reset pipeline");
m_resetPipeline = true;
changePipelineState(GST_STATE_PAUSED);
if (!changePipelineState(GST_STATE_PAUSED))
loadingFailed(MediaPlayer::Empty);
}
} else {
// We can seek now.
Expand Down Expand Up @@ -828,7 +832,8 @@ gboolean MediaPlayerPrivateGStreamer::handleMessage(GstMessage* message)
INFO_MEDIA_MESSAGE("Element %s requested state change to %s", elementName.get(),
gst_element_state_get_name(requestedState));
m_requestedState = requestedState;
changePipelineState(requestedState);
if (!changePipelineState(requestedState))
loadingFailed(MediaPlayer::Empty);
}
break;
case GST_MESSAGE_ELEMENT:
Expand Down Expand Up @@ -1108,6 +1113,11 @@ void MediaPlayerPrivateGStreamer::updateStates()
case GST_STATE_CHANGE_SUCCESS: {
LOG_MEDIA_MESSAGE("State: %s, pending: %s", gst_element_state_get_name(state), gst_element_state_get_name(pending));

// Do nothing if on EOS and state changed to READY to avoid recreating the player
// on HTMLMediaElement and properly generate the video 'ended' event.
if (m_isEndReached && state == GST_STATE_READY)
break;

if (state <= GST_STATE_READY) {
m_resetPipeline = true;
m_mediaDuration = 0;
Expand All @@ -1125,12 +1135,8 @@ void MediaPlayerPrivateGStreamer::updateStates()
m_networkState = MediaPlayer::Empty;
break;
case GST_STATE_READY:
// Do not change network/ready states if on EOS and state changed to READY to avoid
// recreating the player on HTMLMediaElement.
if (!m_isEndReached) {
m_readyState = MediaPlayer::HaveMetadata;
m_networkState = MediaPlayer::Empty;
}
m_readyState = MediaPlayer::HaveMetadata;
m_networkState = MediaPlayer::Empty;
break;
case GST_STATE_PAUSED:
case GST_STATE_PLAYING:
Expand Down Expand Up @@ -1423,8 +1429,7 @@ void MediaPlayerPrivateGStreamer::loadingFailed(MediaPlayer::NetworkState error)
m_player->readyStateChanged();
}

// Loading failed, force reset pipeline and remove ready timer.
gst_element_set_state(m_playBin.get(), GST_STATE_NULL);
// Loading failed, remove ready timer.
if (m_readyTimerHandler) {
g_source_remove(m_readyTimerHandler);
m_readyTimerHandler = 0;
Expand Down

0 comments on commit 81c5857

Please sign in to comment.