diff --git a/constants.gradle b/constants.gradle index 634b3e8536..054dd37f80 100644 --- a/constants.gradle +++ b/constants.gradle @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. project.ext { - releaseVersion = '1.2.1-dr9' + releaseVersion = '1.2.1-dr10' releaseVersionCode = 1_002_001_3_00 minSdkVersion = 16 // See https://developer.android.com/training/cars/media/automotive-os#automotive-module diff --git a/libraries/common/src/main/java/androidx/media3/common/util/MediaFormatUtil.java b/libraries/common/src/main/java/androidx/media3/common/util/MediaFormatUtil.java index 32fe6c156a..1824b33f2d 100644 --- a/libraries/common/src/main/java/androidx/media3/common/util/MediaFormatUtil.java +++ b/libraries/common/src/main/java/androidx/media3/common/util/MediaFormatUtil.java @@ -252,7 +252,7 @@ public static void maybeSetByteBuffer(MediaFormat format, String key, @Nullable */ @SuppressWarnings("InlinedApi") public static void maybeSetColorInfo(MediaFormat format, @Nullable ColorInfo colorInfo) { - if (!ColorInfo.isEquivalentToAssumedSdrDefault(colorInfo)) { + if (colorInfo != null) { maybeSetInteger(format, MediaFormat.KEY_COLOR_TRANSFER, colorInfo.colorTransfer); maybeSetInteger(format, MediaFormat.KEY_COLOR_STANDARD, colorInfo.colorSpace); maybeSetInteger(format, MediaFormat.KEY_COLOR_RANGE, colorInfo.colorRange); diff --git a/libraries/common/src/test/java/androidx/media3/common/util/MediaFormatUtilTest.java b/libraries/common/src/test/java/androidx/media3/common/util/MediaFormatUtilTest.java index 9616b8dbb3..7bd10d7ff4 100644 --- a/libraries/common/src/test/java/androidx/media3/common/util/MediaFormatUtilTest.java +++ b/libraries/common/src/test/java/androidx/media3/common/util/MediaFormatUtilTest.java @@ -240,16 +240,4 @@ public void createMediaFormatFromFormat_withCustomPcmEncoding_setsCustomPcmEncod .isEqualTo(C.ENCODING_PCM_16BIT_BIG_ENDIAN); assertThat(mediaFormat.containsKey(MediaFormat.KEY_PCM_ENCODING)).isFalse(); } - - @Test - public void createMediaFormatFromFormat_withSdrColorInfo_omitsMediaFormatColorInfoKeys() { - Format format = new Format.Builder().setColorInfo(ColorInfo.SDR_BT709_LIMITED).build(); - - MediaFormat mediaFormat = MediaFormatUtil.createMediaFormatFromFormat(format); - - assertThat(mediaFormat.containsKey(MediaFormat.KEY_COLOR_TRANSFER)).isFalse(); - assertThat(mediaFormat.containsKey(MediaFormat.KEY_COLOR_RANGE)).isFalse(); - assertThat(mediaFormat.containsKey(MediaFormat.KEY_COLOR_STANDARD)).isFalse(); - assertThat(mediaFormat.containsKey(MediaFormat.KEY_HDR_STATIC_INFO)).isFalse(); - } } diff --git a/libraries/session/src/main/java/androidx/media3/session/ext/MediaSessionConnector.java b/libraries/session/src/main/java/androidx/media3/session/ext/MediaSessionConnector.java index 891aeee4a8..20c4a9d0a7 100644 --- a/libraries/session/src/main/java/androidx/media3/session/ext/MediaSessionConnector.java +++ b/libraries/session/src/main/java/androidx/media3/session/ext/MediaSessionConnector.java @@ -1049,7 +1049,9 @@ public MediaMetadataCompat getMetadata(Player player) { player.isCurrentMediaItemDynamic() || player.getDuration() == C.TIME_UNSET ? -1 : player.getDuration()); - long activeQueueItemId = mediaController.getPlaybackState().getActiveQueueItemId(); + long activeQueueItemId = mediaController.getPlaybackState() == null + ? MediaSessionCompat.QueueItem.UNKNOWN_ID + : mediaController.getPlaybackState().getActiveQueueItemId(); if (activeQueueItemId != MediaSessionCompat.QueueItem.UNKNOWN_ID) { List queue = mediaController.getQueue(); for (int i = 0; queue != null && i < queue.size(); i++) {