Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upExtend the Player API with the set_rate function #168
Conversation
|
related with servo/servo#22293 |
|
keep in mind that some media cannot be played at different rates, and player will return an error via right now all the player's error are handled equally: the player stops. We might want something different. Perhaps we should check if there's an error right after the rate set. Or better yet, check the media info from player and verify if the stream is seekable, if it's seekable, then the rate change is possible. |
|
I would also suggest that based on your requirements we extend the player error API to actually give useful details. |
|
Thanks for the PR! The code looks good, but I'd like us to apply @ceyusa's suggestion about checking if the stream is seekable before changing the playback rate. We are already getting the stream's media info and converting it to our own metadata format. We will need to add an |
I filed #169 to track that work |
|
Ok, so I added the requested changes but I have one question. What should be done in the case where |
|
If We do something similar with |
|
I added the requested changes. |
I think you missed this last part. We still need to set the stored rate when we get the media info. |
|
Yeah, it looks like I missed that. Now I modified the code accordingly. |
|
Thanks! The changes look good. However, this seems to be making the |
|
Shouldn't the rate change event be handled using connect_property_rate_notify? |
|
Sorry for the late reply here. Last week was a bit busy for many Mozillians :)
Yes, it may be good to expose a Player event based on this signal, so we can trigger the ratechange event more accurately.
The problem was that the test was buggy. I fixed it in #173, so rebasing on top of master should make this PR pass the tests as well. |
| .player | ||
| .connect_property_rate_notify(move |_| { | ||
| let inner = inner_clone.lock().unwrap(); | ||
| inner.player.set_rate(inner.rate); |
This comment has been minimized.
This comment has been minimized.
ferjm
Dec 13, 2018
Member
I don't think this is the right place to set the rate property. IIUC this event is triggered whenever the rate property changes, so we are effectively creating a loop here (unless GStreamer controls this somehow).
You are probably observing the simple_player test pass after this change because this event is never triggered (?).
I think the right place to set the rate is when we get the media info and we are able to check if the stream is seekable, as we were doing previously.
This comment has been minimized.
This comment has been minimized.
georgeroman
Dec 13, 2018
Author
Contributor
Yeah, it makes sense, I didn't fully understand what was happening there but I got it now. Ok, so I modified the rate update as it was previously done.
| @@ -145,6 +149,18 @@ impl PlayerInner { | |||
| Ok(()) | |||
| } | |||
|
|
|||
| pub fn set_rate(&mut self, rate: f64) -> Result<(), BackendError> { | |||
| self.rate = rate; | |||
This comment has been minimized.
This comment has been minimized.
ferjm
Dec 13, 2018
Member
One final change, let's add this comment here:
This method may be called before the player setup is done, so we safe the rate value and set it once the player is ready and after getting the media info
|
Thanks! |
georgeroman commentedNov 29, 2018
No description provided.