Skip to content

Commit 4b8f01c

Browse files
authored
Fix/issues (#34)
* Fix the PlaybackStateCompat npe issue * Partial revert of the black screen fix, see androidx/media@ed505df * Bump version to dr10
1 parent 23dc607 commit 4b8f01c

File tree

4 files changed

+5
-15
lines changed

4 files changed

+5
-15
lines changed

constants.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414
project.ext {
15-
releaseVersion = '1.2.1-dr9'
15+
releaseVersion = '1.2.1-dr10'
1616
releaseVersionCode = 1_002_001_3_00
1717
minSdkVersion = 16
1818
// See https://developer.android.com/training/cars/media/automotive-os#automotive-module

libraries/common/src/main/java/androidx/media3/common/util/MediaFormatUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public static void maybeSetByteBuffer(MediaFormat format, String key, @Nullable
252252
*/
253253
@SuppressWarnings("InlinedApi")
254254
public static void maybeSetColorInfo(MediaFormat format, @Nullable ColorInfo colorInfo) {
255-
if (!ColorInfo.isEquivalentToAssumedSdrDefault(colorInfo)) {
255+
if (colorInfo != null) {
256256
maybeSetInteger(format, MediaFormat.KEY_COLOR_TRANSFER, colorInfo.colorTransfer);
257257
maybeSetInteger(format, MediaFormat.KEY_COLOR_STANDARD, colorInfo.colorSpace);
258258
maybeSetInteger(format, MediaFormat.KEY_COLOR_RANGE, colorInfo.colorRange);

libraries/common/src/test/java/androidx/media3/common/util/MediaFormatUtilTest.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,4 @@ public void createMediaFormatFromFormat_withCustomPcmEncoding_setsCustomPcmEncod
240240
.isEqualTo(C.ENCODING_PCM_16BIT_BIG_ENDIAN);
241241
assertThat(mediaFormat.containsKey(MediaFormat.KEY_PCM_ENCODING)).isFalse();
242242
}
243-
244-
@Test
245-
public void createMediaFormatFromFormat_withSdrColorInfo_omitsMediaFormatColorInfoKeys() {
246-
Format format = new Format.Builder().setColorInfo(ColorInfo.SDR_BT709_LIMITED).build();
247-
248-
MediaFormat mediaFormat = MediaFormatUtil.createMediaFormatFromFormat(format);
249-
250-
assertThat(mediaFormat.containsKey(MediaFormat.KEY_COLOR_TRANSFER)).isFalse();
251-
assertThat(mediaFormat.containsKey(MediaFormat.KEY_COLOR_RANGE)).isFalse();
252-
assertThat(mediaFormat.containsKey(MediaFormat.KEY_COLOR_STANDARD)).isFalse();
253-
assertThat(mediaFormat.containsKey(MediaFormat.KEY_HDR_STATIC_INFO)).isFalse();
254-
}
255243
}

libraries/session/src/main/java/androidx/media3/session/ext/MediaSessionConnector.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,9 @@ public MediaMetadataCompat getMetadata(Player player) {
10491049
player.isCurrentMediaItemDynamic() || player.getDuration() == C.TIME_UNSET
10501050
? -1
10511051
: player.getDuration());
1052-
long activeQueueItemId = mediaController.getPlaybackState().getActiveQueueItemId();
1052+
long activeQueueItemId = mediaController.getPlaybackState() == null
1053+
? MediaSessionCompat.QueueItem.UNKNOWN_ID
1054+
: mediaController.getPlaybackState().getActiveQueueItemId();
10531055
if (activeQueueItemId != MediaSessionCompat.QueueItem.UNKNOWN_ID) {
10541056
List<MediaSessionCompat.QueueItem> queue = mediaController.getQueue();
10551057
for (int i = 0; queue != null && i < queue.size(); i++) {

0 commit comments

Comments
 (0)