Commit ed188d1b by olly Committed by Oliver Woodman

Apply video scaling mode correctly.

Issue: #1428
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119952373
parent c99250d9
......@@ -254,7 +254,7 @@ public class MediaCodecAudioTrackRenderer extends MediaCodecTrackRenderer implem
}
@Override
protected void onOutputFormatChanged(MediaFormat outputFormat) {
protected void onOutputFormatChanged(MediaCodec codec, MediaFormat outputFormat) {
boolean passthrough = passthroughMediaFormat != null;
audioTrack.configure(passthrough ? passthroughMediaFormat : outputFormat, passthrough);
}
......
......@@ -28,7 +28,6 @@ import android.media.MediaCodec;
import android.media.MediaCodec.CodecException;
import android.media.MediaCodec.CryptoException;
import android.media.MediaCrypto;
import android.media.MediaFormat;
import android.os.Handler;
import android.os.SystemClock;
......@@ -705,10 +704,10 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
* <p>
* The default implementation is a no-op.
*
* @param codec The {@link MediaCodec} instance.
* @param outputFormat The new output format.
* @throws ExoPlaybackException If an error occurs on output format change.
*/
protected void onOutputFormatChanged(MediaFormat outputFormat) throws ExoPlaybackException {
protected void onOutputFormatChanged(MediaCodec codec, android.media.MediaFormat outputFormat) {
// Do nothing.
}
......@@ -849,7 +848,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
if (codecNeedsMonoChannelCountWorkaround) {
format.setInteger(android.media.MediaFormat.KEY_CHANNEL_COUNT, 1);
}
onOutputFormatChanged(format);
onOutputFormatChanged(codec, format);
codecCounters.outputFormatChangedCount++;
}
......
......@@ -391,7 +391,7 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
}
@Override
protected void onOutputFormatChanged(MediaFormat outputFormat) {
protected void onOutputFormatChanged(MediaCodec codec, android.media.MediaFormat outputFormat) {
boolean hasCrop = outputFormat.containsKey(KEY_CROP_RIGHT)
&& outputFormat.containsKey(KEY_CROP_LEFT) && outputFormat.containsKey(KEY_CROP_BOTTOM)
&& outputFormat.containsKey(KEY_CROP_TOP);
......@@ -416,6 +416,8 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
// On API level 20 and below the decoder does not apply the rotation.
currentUnappliedRotationDegrees = pendingRotationDegrees;
}
// Must be applied each time the output format changes.
codec.setVideoScalingMode(videoScalingMode);
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment