Bug 30000 - [GStreamer] Check return values of gst_element_set_state()
Summary: [GStreamer] Check return values of gst_element_set_state()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-02 01:32 PDT by Sebastian Dröge (slomo)
Modified: 2010-01-14 03:41 PST (History)
3 users (show)

See Also:


Attachments
Check return values of gst_element_set_state() (2.72 KB, patch)
2009-12-07 03:29 PST, Philippe Normand
eric: review-
Details | Formatted Diff | Diff
Check for state change failure when going from READY/NULL to PAUSED or PLAYING. (4.04 KB, patch)
2009-12-09 01:05 PST, Philippe Normand
no flags Details | Formatted Diff | Diff
Check for state change failure when going from READY/NULL to PAUSED or PLAYING. (4.18 KB, text/plain)
2009-12-15 08:55 PST, Philippe Normand
no flags Details
Check for state change failure when going from READY/NULL to PAUSED or PLAYING. (4.18 KB, patch)
2009-12-15 09:06 PST, Philippe Normand
xan.lopez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Dröge (slomo) 2009-10-02 01:32:13 PDT
Hi,
currently the media player doesn't check the return values of gst_element_set_state(). It should really do that.

If it's SUCCESS, NO_PREROLL or ASYNC everything is fine (errors will be posted as bus message), if it's FAILURE things should fail immediately (there will be no error messages on the bus in the worst case).

This is only for state changes from NULL or READY to PAUSED or PLAYING. Downwards state changes can fail but you're usually not interested in that.
Comment 1 Philippe Normand 2009-12-07 03:29:38 PST
Created attachment 44398 [details]
Check return values of gst_element_set_state()

when going from READY/NULL to PAUSED or PLAYING.
Comment 2 WebKit Review Bot 2009-12-07 03:31:55 PST
style-queue ran check-webkit-style on attachment 44398 [details] without any errors.
Comment 3 Eric Seidel (no email) 2009-12-08 11:26:29 PST
Comment on attachment 44398 [details]
Check return values of gst_element_set_state()

It seems play and pause could share all of their code here in a single method which took either GST_STATE_PAUSED or GST_STATE_PLAYING.

I think that would be cleaner long-term.
Comment 4 Philippe Normand 2009-12-09 01:05:43 PST
Created attachment 44519 [details]
Check for state change failure when going from READY/NULL to PAUSED or PLAYING.
Comment 5 Eric Seidel (no email) 2009-12-14 13:01:37 PST
Comment on attachment 44519 [details]
Check for state change failure when going from READY/NULL to PAUSED or PLAYING.

OK.  There is one slight change in logging behavior here, it won't log Play if the switch to play fails.  I don't think that matters though.

Style violation:
 121             bool changePipelineState(GstState state);
we don't name arguments when the name doesn't add anything.

Shouldn't changePipelineState be private?

And why is it called "pipeline state"?

It would appear that this function only works for either PLAY or PAUSE, but I don't see you asserting that anywhere.  You might want to ASSERT the inputs.
Comment 6 Philippe Normand 2009-12-15 08:55:15 PST
Created attachment 44879 [details]
Check for state change failure when going from READY/NULL to PAUSED or PLAYING.

Check for state change failure

When going from READY/NULL to PAUSED or PLAYING.
Comment 7 Philippe Normand 2009-12-15 08:56:31 PST
Comment on attachment 44879 [details]
Check for state change failure when going from READY/NULL to PAUSED or PLAYING.

Sorry that one is broken
Comment 8 Philippe Normand 2009-12-15 09:01:47 PST
(In reply to comment #5)
> (From update of attachment 44519 [details])
> OK.  There is one slight change in logging behavior here, it won't log Play if
> the switch to play fails.  I don't think that matters though.
> 
> Style violation:
>  121             bool changePipelineState(GstState state);
> we don't name arguments when the name doesn't add anything.

Well the variable is used in the code, I will name it newState, which adds "new" :)

> 
> Shouldn't changePipelineState be private?
> 

It is already a private method. Did I do something wrong?

> And why is it called "pipeline state"?
> 

This is the GStreamer vocabulary, the pipeline is composed of elements, linked etween themselves. To start playback you set the pipeline state to PLAYING, the state change propagates through the elements of the pipeline.

> It would appear that this function only works for either PLAY or PAUSE, but I
> don't see you asserting that anywhere.  You might want to ASSERT the inputs.

Will do ;)

Thanks for  the review, I will send a new patch.
Comment 9 Philippe Normand 2009-12-15 09:06:39 PST
Created attachment 44880 [details]
Check for state change failure when going from READY/NULL to PAUSED or PLAYING.

When going from READY/NULL to PAUSED or PLAYING.
Comment 10 WebKit Review Bot 2009-12-16 02:02:44 PST
style-queue ran check-webkit-style on attachment 44880 [details] without any errors.
Comment 11 Xan Lopez 2010-01-14 03:14:38 PST
Comment on attachment 44880 [details]
Check for state change failure when going from READY/NULL to PAUSED or PLAYING.

Makes sense, although I guess it would be best to somehow inform the user instead of silently doing nothing? It can be done in a follow-up though.
Comment 12 Philippe Normand 2010-01-14 03:41:06 PST
Landed as r53255. Thanks!