Skip to content

Commit

Permalink
Fix/issues (#34)
Browse files Browse the repository at this point in the history
* Fix the PlaybackStateCompat npe issue

* Partial revert of the black screen fix, see androidx/media@ed505df

* Bump version to dr10
  • Loading branch information
guoen21 authored Dec 23, 2024
1 parent 23dc607 commit 4b8f01c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion constants.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<MediaSessionCompat.QueueItem> queue = mediaController.getQueue();
for (int i = 0; queue != null && i < queue.size(); i++) {
Expand Down

0 comments on commit 4b8f01c

Please sign in to comment.