Changeset 53255 in webkit


Ignore:
Timestamp:
Jan 14, 2010 3:40:18 AM (14 years ago)
Author:
Philippe Normand
Message:

2009-12-09 Philippe Normand <pnormand@igalia.com>

Reviewed by Xan Lopez.

[GStreamer] Check return values of gst_element_set_state()
https://bugs.webkit.org/show_bug.cgi?id=30000

Check for state change failure when going from READY/NULL to
PAUSED or PLAYING. Also refactored the common code of play() and
pause() to a new private method of the player.

  • platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivate::changePipelineState): (WebCore::MediaPlayerPrivate::play): (WebCore::MediaPlayerPrivate::pause):
  • platform/graphics/gtk/MediaPlayerPrivateGStreamer.h:
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r53252 r53255  
     12009-12-09  Philippe Normand  <pnormand@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GStreamer] Check return values of gst_element_set_state()
     6        https://bugs.webkit.org/show_bug.cgi?id=30000
     7
     8        Check for state change failure when going from READY/NULL to
     9        PAUSED or PLAYING. Also refactored the common code of play() and
     10        pause() to a new private method of the player.
     11
     12        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
     13        (WebCore::MediaPlayerPrivate::changePipelineState):
     14        (WebCore::MediaPlayerPrivate::play):
     15        (WebCore::MediaPlayerPrivate::pause):
     16        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.h:
     17
    1182010-01-14  Eric Seidel  <eric@webkit.org>
    219
  • trunk/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp

    r53244 r53255  
    143143}
    144144
     145
    145146void mediaPlayerPrivateRepaintCallback(WebKitVideoSink*, GstBuffer *buffer, MediaPlayerPrivate* playerPrivate)
    146147{
     
    260261}
    261262
     263bool MediaPlayerPrivate::changePipelineState(GstState newState)
     264{
     265    ASSERT(newState == GST_STATE_PLAYING || newState == GST_STATE_PAUSED);
     266
     267    GstState currentState;
     268    GstState pending;
     269
     270    gst_element_get_state(m_playBin, &currentState, &pending, 0);
     271    if (currentState != newState && pending != newState) {
     272        GstStateChangeReturn ret = gst_element_set_state(m_playBin, newState);
     273        GstState pausedOrPlaying = newState == GST_STATE_PLAYING ? GST_STATE_PAUSED : GST_STATE_PLAYING;
     274        if (currentState != pausedOrPlaying && ret == GST_STATE_CHANGE_FAILURE) {
     275            loadingFailed(MediaPlayer::Empty);
     276            return false;
     277        }
     278    }
     279    return true;
     280}
     281
    262282void MediaPlayerPrivate::play()
    263283{
    264     GstState state;
    265     GstState pending;
    266 
    267     gst_element_get_state(m_playBin, &state, &pending, 0);
    268     if (state != GST_STATE_PLAYING && pending != GST_STATE_PLAYING) {
     284    if (changePipelineState(GST_STATE_PLAYING))
    269285        LOG_VERBOSE(Media, "Play");
    270         gst_element_set_state(m_playBin, GST_STATE_PLAYING);
    271     }
    272286}
    273287
    274288void MediaPlayerPrivate::pause()
    275289{
    276     GstState state;
    277     GstState pending;
    278 
    279     gst_element_get_state(m_playBin, &state, &pending, 0);
    280     if (state != GST_STATE_PAUSED  && pending != GST_STATE_PAUSED) {
     290    if (changePipelineState(GST_STATE_PAUSED))
    281291        LOG_VERBOSE(Media, "Pause");
    282         gst_element_set_state(m_playBin, GST_STATE_PAUSED);
    283     }
    284292}
    285293
  • trunk/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.h

    r53244 r53255  
    121121
    122122            void createGSTPlayBin(String url);
     123            bool changePipelineState(GstState state);
    123124
    124125        private:
Note: See TracChangeset for help on using the changeset viewer.