Skip to content
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

Use framework speed adjustment where possible (e.g., API 23+) #7502

Closed
ghost opened this issue Jun 15, 2020 · 1 comment
Closed

Use framework speed adjustment where possible (e.g., API 23+) #7502

ghost opened this issue Jun 15, 2020 · 1 comment
Assignees

Comments

@ghost
Copy link

ghost commented Jun 15, 2020

I have used ConcatenatingMediaSource to play videos one by one. I am working on video editing app. There is speed changes feature also. I have set speed 0.5 for 1st video, then 1 for 2nd video and 4 for 3rd video. It is working fine when I play video from specific position using player.seekTo(currentPosition, C.TIME_UNSET). But When play video one by one then its take time to change speed. 1st video play at speed 0.5 and then 1st video plays end and 2nd start playing it will play for 0 - 1 second at speed of 0.5 then play at speed of 1.
Please guide me handle it.

@andrewlewis andrewlewis self-assigned this Jun 15, 2020
@andrewlewis
Copy link
Collaborator

This report sounds the same as #6649. The underlying problem is that we speed up/slow down audio before writing it to the AudioTrack, but this means that on a speed change the track's buffer has to drain before the new speed takes effect.

As a hacky workaround for the short term, you could use a timed message (#2189) to set playback speed one second before the end of a track.

For #6649 the enhancement being tracked is to support setting playback parameters at a given position, which would allow us to take into account the audio track latency. However, we're now considering an alternative fix which is to switch to using framework speed adjustment (from API 23) instead of modifying the audio ourselves, which has the major advantage that the speed adjustment happens in the mixer, eliminating most of the delay. Let's use this issue to track using framework speed adjustment where possible, and I'll also leave the other issue open in case we run into problems with this option.

@andrewlewis andrewlewis assigned Samrobbo and unassigned andrewlewis Jun 15, 2020
@ojw28 ojw28 changed the title Video Speed changes Use framework speed adjustment where possible (e.g., API 23+) Jun 15, 2020
kim-vde pushed a commit that referenced this issue Aug 17, 2020
AudioTrack.setPlaybackParams can be used to adjust playback speed.
This is preferable to application-level speed adjustment (currently
implemented in ExoPlayer) from API 23 because the speed change
occurs in the mixer, which means that the audio track buffer doesn't
need to drain out before the speed adjustment takes effect.

Issue: #7502
PiperOrigin-RevId: 326392301
@Samrobbo Samrobbo assigned andrewlewis and unassigned Samrobbo Nov 23, 2020
@google google locked and limited conversation to collaborators Jan 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants