mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Add supports for frame-capture retrying for MetadataRetriever.
For the MetadataRetriever, for certain queries, after setting up the player to render a frame (by seeking to the position), sometimes the player will seek to the same position and ignore the seek, leading to the frame not being captured, leaving the retriever in deadlock, waiting for the frame forever. This CL adds a retry timer to avoid this and make sure we can return query result after some time. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=204460200
This commit is contained in:
parent
cba6da8906
commit
7cba5429fc
4 changed files with 24 additions and 1 deletions
|
|
@ -242,4 +242,7 @@ public interface ExoPlayer extends Player {
|
|||
* @param seekParameters The seek parameters, or {@code null} to use the defaults.
|
||||
*/
|
||||
void setSeekParameters(@Nullable SeekParameters seekParameters);
|
||||
|
||||
/** Returns the currently active {@link SeekParameters} of the player. */
|
||||
SeekParameters getSeekParameters();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||
private boolean hasPendingPrepare;
|
||||
private boolean hasPendingSeek;
|
||||
private PlaybackParameters playbackParameters;
|
||||
private SeekParameters seekParameters;
|
||||
private @Nullable ExoPlaybackException playbackError;
|
||||
|
||||
// Playback information when there is no pending seek/set source operation.
|
||||
|
|
@ -108,6 +109,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||
window = new Timeline.Window();
|
||||
period = new Timeline.Period();
|
||||
playbackParameters = PlaybackParameters.DEFAULT;
|
||||
seekParameters = SeekParameters.DEFAULT;
|
||||
eventHandler =
|
||||
new Handler(looper) {
|
||||
@Override
|
||||
|
|
@ -339,7 +341,15 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||
if (seekParameters == null) {
|
||||
seekParameters = SeekParameters.DEFAULT;
|
||||
}
|
||||
internalPlayer.setSeekParameters(seekParameters);
|
||||
if (!this.seekParameters.equals(seekParameters)) {
|
||||
this.seekParameters = seekParameters;
|
||||
internalPlayer.setSeekParameters(seekParameters);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SeekParameters getSeekParameters() {
|
||||
return seekParameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -791,6 +791,11 @@ public class SimpleExoPlayer
|
|||
player.setSeekParameters(seekParameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SeekParameters getSeekParameters() {
|
||||
return player.getSeekParameters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Object getCurrentTag() {
|
||||
return player.getCurrentTag();
|
||||
|
|
|
|||
|
|
@ -159,6 +159,11 @@ public abstract class StubExoPlayer implements ExoPlayer {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SeekParameters getSeekParameters() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Object getCurrentTag() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
|
|
|||
Loading…
Reference in a new issue