google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.7k stars 6.02k forks source link

Get Low-latency live streaming adjusted playback speed #8620

Open jrocharodrigues opened 3 years ago

jrocharodrigues commented 3 years ago

Hi,

Is it possible to get the current speed of the player (the on that the renderer is using? I'm trying to get it in order to have some data to help in the adjustment of the stream parameters for Low-latency live streaming, but i couldn't find i way to observer it. I've thought i could obtain it using the onPlaybackParametersChanged callback, but those values doesn't change even when the DefaultClock adjusted speed changes.

Thanks for the help

tonihei commented 3 years ago

We didn't add a callback for this under the assumption that the actual speed is an implementation detail.

Could you provide more details on the type of adjustment you are planning to understand if such a callback would be generally useful?

If you'd like to get some insights in the behavior of the algorithm during run time you could either add logging directly in DefaultLivePlaybackSpeedControl (in case you have the code checked out locally), or write a wrapper LivePlaybackSpeedControl class that forwards all calls to DefaultLivePlaybackSpeedControl. In there you could add logging (e.g. ingetAdjustedPlaybackSpeed) or call a custom method whenever the speed changes. The wrapper LivePlaybackSpeedControl can then be set when building the player: new SimpleExoPlayer.Builder().setLivePlaybackSpeedControl(new WrapperClass()).build().

jrocharodrigues commented 3 years ago

Hi, Thanks for the quick answer, i'll go with wrapper for now.

The use case here is to have some statistics on how often, and how, the adjusted speed changes to use that data to better configure the streaming server and/or the app and reduce that behaviour.

Me and my team are starting to experiment LL Live Streaming, to take it to production in near future, and at least in this stage this data seems useful for us.

tonihei commented 3 years ago

Thanks. Please let us know if you find something useful :) And also if you think it would be helpful to have a callback for this in the long term and not just for your debugging/tuning.

jrocharodrigues commented 3 years ago

Ok, i'll leave some feedback in the future.

tonihei commented 3 years ago

Converting to an enhancement to track a potential future implementation.