Use removeKey
method instead of setting null
for KEY_CODECS_STRING
Setting a `null` value doesn't remove the key as expected per the `MediaFormat` API documentation, using the `removeKey` method instead which is only available starting API level 29. PiperOrigin-RevId: 646462402
This commit is contained in:
parent
5fcc7433a1
commit
12c42585d2
@ -647,7 +647,9 @@ public final class MediaExtractorCompat {
|
||||
MediaFormat mediaFormatResult = MediaFormatUtil.createMediaFormatFromFormat(result);
|
||||
scratchFormatHolder.clear();
|
||||
if (compatibilityTrackMimeType != null) {
|
||||
mediaFormatResult.setString(MediaFormat.KEY_CODECS_STRING, null);
|
||||
if (Util.SDK_INT >= 29) {
|
||||
mediaFormatResult.removeKey(MediaFormat.KEY_CODECS_STRING);
|
||||
}
|
||||
mediaFormatResult.setString(MediaFormat.KEY_MIME, compatibilityTrackMimeType);
|
||||
}
|
||||
return mediaFormatResult;
|
||||
|
Loading…
x
Reference in New Issue
Block a user