mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
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
(cherry picked from commit 12c42585d2)
This commit is contained in:
parent
0f0a20bc1c
commit
0b87e176fd
1 changed files with 3 additions and 1 deletions
|
|
@ -647,7 +647,9 @@ public final class MediaExtractorCompat {
|
||||||
MediaFormat mediaFormatResult = MediaFormatUtil.createMediaFormatFromFormat(result);
|
MediaFormat mediaFormatResult = MediaFormatUtil.createMediaFormatFromFormat(result);
|
||||||
scratchFormatHolder.clear();
|
scratchFormatHolder.clear();
|
||||||
if (compatibilityTrackMimeType != null) {
|
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);
|
mediaFormatResult.setString(MediaFormat.KEY_MIME, compatibilityTrackMimeType);
|
||||||
}
|
}
|
||||||
return mediaFormatResult;
|
return mediaFormatResult;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue