mirror of
https://github.com/androidx/media.git
synced 2025-05-11 09:39:52 +08:00
Apply video scaling mode correctly.
Issue: #1428 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=119952373
This commit is contained in:
parent
c99250d9c5
commit
ed188d1bc8
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user