-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Fast Forward and Rewind during Timeshifting and playing back of Recorded Shows #239
base: develop
Are you sure you want to change the base?
Conversation
mDataSource.setSpeed(translatedSpeed); | ||
mExoPlayer.setPlaybackParameters(new PlaybackParameters(translatedSpeed, 0)); | ||
mDataSource.setSpeed(speed); | ||
mExoPlayer.setPlaybackParameters(new PlaybackParameters(speed, 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this works out?
mDataSource.setSpeed(speed);
passes the speed value over to TVheadend, which expects:
speed u32 required Specify speed (0=pause, 100=1x fwd, -100=1x backward)
http://tvheadend.org/projects/tvheadend/wiki/Htsp#subscriptionSpeed-Added-in-version-9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, maybe it doesn't get passed over! Apparently, I haven't committed that code ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The high memory usage might be related to my comment inline re passing of the speed through to the TVHeadend, without passing it through, TVHeadend will as far as I know keep sending you video data as soon as it has it - rather than letting it buffer server side. Will test this out tomorrow.
It seems that rewind is not working - it doesn't seem like HtspSession#onTimeShiftSetPlaybackParams is being called at all when rewinding, at least not in my testing. |
I've been refreshing my memory... Rewind is significantly harder, as ExoPlayer doesn't support playing in reverse (as media codecs in general don't really support that either). I've created PR #243 with your code, and a few extra changes - but it still doesn't seem to be quite reliable yet - specifically, if you pause, wait a bit, and then fast-forward through the buffer - the audio will get way out of sync. |
Much tidier now, thanks! With regards to rewind support, is it possible to simply skip back frames, it wouldn't be as nice as changing the speed obviously, but it's better than nothing. Although this might not be practical, my understanding of ExoPlayer is rather limited at this stage. I will see if I can reproduce the audio sync issue as well, because it sounds like it could be quite tricky to sort out. (a little offtopic but I would appreciate your input in #242) |
I've been playing with that - the code is messy as hell but works - I've pushed that commit to the other PR.
What I don't quite get is, ExoPlayer should be handling that for us. All the different tracks -audio, video, text come with presentation timestamps - and the audio tracks timestamp is used to synchronise the playback rates and positions of each. If there is a mismatch, ExoPlayer should pause the video - line things back up - and resume. So, I'm quite confused as to how the delay exists :) re the translated speeds - So - there doesn't seem to be a fixed mapping from the UI display (2x, 3x, 4x, 5x) to the value we receive! Playing with this for the last little while, I keep getting different values passed in. I've not quite figured out what's happening here, but I suspect Android TV's UI is "lying" - and when it says for example "2x Rewind" on the UI, it's giving us totally different numbers.
However - the UI doesn't even go below -5x rewind, yet we get much lower numbers than |
With regards to the audio sync issue, are we able to print timestamps of the audio / video every second or so, so we can see when it becomes out of sync? With the speed factors, from what I saw in my testing it was 2, 8, 32 etc, do the numbers match this pattern? |
@TheDiamondPicks have you given up on tvheadend in Android TV, or did you switch to another TV backend service? |
@michaelarnauts yeah, I've switch to Plex now, which unfortunately doesn't have a live channels backend, but the integration into the rest of Plex outweighed those downsides for me. |
Title says all
I have tested this, and it seems to work well although it does cause low memory warnings on the Mi Box.