Reset camera motion rotation when camera motion track is disabled

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=210696525
This commit is contained in:
eguven 2018-08-29 03:43:56 -07:00 committed by Oliver Woodman
parent 13889c9116
commit ca0e276798
2 changed files with 10 additions and 6 deletions

View file

@ -27,6 +27,6 @@ public interface CameraMotionListener {
*/ */
void onCameraMotion(long timeUs, float[] rotation); void onCameraMotion(long timeUs, float[] rotation);
/** Called when the camera motion track position is reset. */ /** Called when the camera motion track position is reset or the track is disabled. */
void onCameraMotionReset(); void onCameraMotionReset();
} }

View file

@ -72,15 +72,12 @@ public class CameraMotionRenderer extends BaseRenderer {
@Override @Override
protected void onPositionReset(long positionUs, boolean joining) throws ExoPlaybackException { protected void onPositionReset(long positionUs, boolean joining) throws ExoPlaybackException {
lastTimestampUs = 0; reset();
if (listener != null) {
listener.onCameraMotionReset();
}
} }
@Override @Override
protected void onDisabled() { protected void onDisabled() {
lastTimestampUs = 0; reset();
} }
@Override @Override
@ -126,4 +123,11 @@ public class CameraMotionRenderer extends BaseRenderer {
} }
return result; return result;
} }
private void reset() {
lastTimestampUs = 0;
if (listener != null) {
listener.onCameraMotionReset();
}
}
} }