mirror of
https://github.com/samsonjs/media.git
synced 2026-04-18 13:25:47 +00:00
Fix video renderer rejoining.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=123976645
This commit is contained in:
parent
a100175b72
commit
69bd31f7c2
8 changed files with 20 additions and 21 deletions
|
|
@ -332,7 +332,7 @@ public final class LibvpxVideoTrackRenderer extends TrackRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onReset(long positionUs) {
|
||||
protected void onReset(long positionUs, boolean joining) {
|
||||
inputStreamEnded = false;
|
||||
outputStreamEnded = false;
|
||||
renderedFirstFrame = false;
|
||||
|
|
|
|||
|
|
@ -256,14 +256,14 @@ public class MediaCodecAudioTrackRenderer extends MediaCodecTrackRenderer implem
|
|||
|
||||
@Override
|
||||
protected void onEnabled(boolean joining) throws ExoPlaybackException {
|
||||
super.onEnabled(joining);
|
||||
codecCounters.reset();
|
||||
eventDispatcher.enabled(codecCounters);
|
||||
super.onEnabled(joining);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onReset(long positionUs) throws ExoPlaybackException {
|
||||
super.onReset(positionUs);
|
||||
protected void onReset(long positionUs, boolean joining) throws ExoPlaybackException {
|
||||
super.onReset(positionUs, joining);
|
||||
audioTrack.reset();
|
||||
currentPositionUs = positionUs;
|
||||
allowPositionDiscontinuity = true;
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onReset(long positionUs) throws ExoPlaybackException {
|
||||
protected void onReset(long positionUs, boolean joining) throws ExoPlaybackException {
|
||||
inputStreamEnded = false;
|
||||
outputStreamEnded = false;
|
||||
if (codec != null) {
|
||||
|
|
@ -830,8 +830,8 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
|
|||
* modified between successive calls. Hence an implementation can, for example, modify the
|
||||
* buffer's position to keep track of how much of the data it has processed.
|
||||
* <p>
|
||||
* Note that the first call to this method following a call to {@link #reset(long)} will always
|
||||
* receive a new {@link ByteBuffer} to be processed.
|
||||
* Note that the first call to this method following a call to {@link #onReset(long, boolean)}
|
||||
* will always receive a new {@link ByteBuffer} to be processed.
|
||||
*
|
||||
* @param positionUs The current media time in microseconds, measured at the start of the
|
||||
* current iteration of the rendering loop.
|
||||
|
|
|
|||
|
|
@ -208,12 +208,9 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
|||
|
||||
@Override
|
||||
protected void onEnabled(boolean joining) throws ExoPlaybackException {
|
||||
super.onEnabled(joining);
|
||||
codecCounters.reset();
|
||||
eventDispatcher.enabled(codecCounters);
|
||||
super.onEnabled(joining);
|
||||
if (joining && allowedJoiningTimeMs > 0) {
|
||||
joiningDeadlineMs = SystemClock.elapsedRealtime() + allowedJoiningTimeMs;
|
||||
}
|
||||
frameReleaseTimeHelper.enable();
|
||||
}
|
||||
|
||||
|
|
@ -236,11 +233,12 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onReset(long positionUs) throws ExoPlaybackException {
|
||||
super.onReset(positionUs);
|
||||
protected void onReset(long positionUs, boolean joining) throws ExoPlaybackException {
|
||||
super.onReset(positionUs, joining);
|
||||
renderedFirstFrame = false;
|
||||
consecutiveDroppedFrameCount = 0;
|
||||
joiningDeadlineMs = -1;
|
||||
joiningDeadlineMs = joining && allowedJoiningTimeMs > 0
|
||||
? (SystemClock.elapsedRealtime() + allowedJoiningTimeMs) : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ public abstract class TrackRenderer implements ExoPlayerComponent {
|
|||
state = STATE_ENABLED;
|
||||
onEnabled(joining);
|
||||
replaceTrackStream(formats, stream);
|
||||
reset(positionUs);
|
||||
onReset(positionUs, joining);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -217,13 +217,13 @@ public abstract class TrackRenderer implements ExoPlayerComponent {
|
|||
}
|
||||
|
||||
/**
|
||||
* Called when a reset is encountered, and also when the renderer is enabled.
|
||||
* Called when a reset is encountered.
|
||||
*
|
||||
* @param positionUs The playback position in microseconds.
|
||||
* @throws ExoPlaybackException If an error occurs handling the reset.
|
||||
*/
|
||||
/* package */ final void reset(long positionUs) throws ExoPlaybackException {
|
||||
onReset(positionUs);
|
||||
onReset(positionUs, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -232,9 +232,10 @@ public abstract class TrackRenderer implements ExoPlayerComponent {
|
|||
* The default implementation is a no-op.
|
||||
*
|
||||
* @param positionUs The playback position in microseconds.
|
||||
* @param joining Whether this renderer is being enabled to join an ongoing playback.
|
||||
* @throws ExoPlaybackException If an error occurs handling the reset.
|
||||
*/
|
||||
protected void onReset(long positionUs) throws ExoPlaybackException {
|
||||
protected void onReset(long positionUs, boolean joining) throws ExoPlaybackException {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ public abstract class AudioDecoderTrackRenderer extends TrackRenderer implements
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onReset(long positionUs) {
|
||||
protected void onReset(long positionUs, boolean joining) {
|
||||
audioTrack.reset();
|
||||
currentPositionUs = positionUs;
|
||||
allowPositionDiscontinuity = true;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public final class MetadataTrackRenderer<T> extends TrackRenderer implements Cal
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onReset(long positionUs) {
|
||||
protected void onReset(long positionUs, boolean joining) {
|
||||
pendingMetadata = null;
|
||||
inputStreamEnded = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public final class TextTrackRenderer extends TrackRenderer implements Callback {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void onReset(long positionUs) {
|
||||
protected void onReset(long positionUs, boolean joining) {
|
||||
inputStreamEnded = false;
|
||||
outputStreamEnded = false;
|
||||
if (subtitle != null) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue