mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
No-op refactor of MediaCodecInfo.isSeamlessAdaptationSupported
PiperOrigin-RevId: 339084261
This commit is contained in:
parent
50566fb8ac
commit
e16ab27b63
1 changed files with 26 additions and 18 deletions
|
|
@ -327,34 +327,42 @@ public final class MediaCodecInfo {
|
||||||
*/
|
*/
|
||||||
public boolean isSeamlessAdaptationSupported(
|
public boolean isSeamlessAdaptationSupported(
|
||||||
Format oldFormat, Format newFormat, boolean isNewFormatComplete) {
|
Format oldFormat, Format newFormat, boolean isNewFormatComplete) {
|
||||||
|
if (!Util.areEqual(oldFormat.sampleMimeType, newFormat.sampleMimeType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (isVideo) {
|
if (isVideo) {
|
||||||
return Assertions.checkNotNull(oldFormat.sampleMimeType).equals(newFormat.sampleMimeType)
|
return oldFormat.rotationDegrees == newFormat.rotationDegrees
|
||||||
&& oldFormat.rotationDegrees == newFormat.rotationDegrees
|
|
||||||
&& (adaptive
|
&& (adaptive
|
||||||
|| (oldFormat.width == newFormat.width && oldFormat.height == newFormat.height))
|
|| (oldFormat.width == newFormat.width && oldFormat.height == newFormat.height))
|
||||||
&& ((!isNewFormatComplete && newFormat.colorInfo == null)
|
&& ((!isNewFormatComplete && newFormat.colorInfo == null)
|
||||||
|| Util.areEqual(oldFormat.colorInfo, newFormat.colorInfo));
|
|| Util.areEqual(oldFormat.colorInfo, newFormat.colorInfo));
|
||||||
} else {
|
} else {
|
||||||
if (!MimeTypes.AUDIO_AAC.equals(mimeType)
|
if (oldFormat.channelCount != newFormat.channelCount
|
||||||
|| !Assertions.checkNotNull(oldFormat.sampleMimeType).equals(newFormat.sampleMimeType)
|
|
||||||
|| oldFormat.channelCount != newFormat.channelCount
|
|
||||||
|| oldFormat.sampleRate != newFormat.sampleRate) {
|
|| oldFormat.sampleRate != newFormat.sampleRate) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Check the codec profile levels support adaptation.
|
|
||||||
@Nullable
|
// Check whether we're adapting between two xHE-AAC formats, for which adaptation is possible
|
||||||
Pair<Integer, Integer> oldCodecProfileLevel =
|
// without reconfiguration.
|
||||||
MediaCodecUtil.getCodecProfileAndLevel(oldFormat);
|
if (MimeTypes.AUDIO_AAC.equals(mimeType)) {
|
||||||
@Nullable
|
@Nullable
|
||||||
Pair<Integer, Integer> newCodecProfileLevel =
|
Pair<Integer, Integer> oldCodecProfileLevel =
|
||||||
MediaCodecUtil.getCodecProfileAndLevel(newFormat);
|
MediaCodecUtil.getCodecProfileAndLevel(oldFormat);
|
||||||
if (oldCodecProfileLevel == null || newCodecProfileLevel == null) {
|
@Nullable
|
||||||
return false;
|
Pair<Integer, Integer> newCodecProfileLevel =
|
||||||
|
MediaCodecUtil.getCodecProfileAndLevel(newFormat);
|
||||||
|
if (oldCodecProfileLevel != null && newCodecProfileLevel != null) {
|
||||||
|
int oldProfile = oldCodecProfileLevel.first;
|
||||||
|
int newProfile = newCodecProfileLevel.first;
|
||||||
|
if (oldProfile == CodecProfileLevel.AACObjectXHE
|
||||||
|
&& newProfile == CodecProfileLevel.AACObjectXHE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int oldProfile = oldCodecProfileLevel.first;
|
|
||||||
int newProfile = newCodecProfileLevel.first;
|
return false;
|
||||||
return oldProfile == CodecProfileLevel.AACObjectXHE
|
|
||||||
&& newProfile == CodecProfileLevel.AACObjectXHE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue