1. 13 Jun, 2022 2 commits
    • Use correct placeholder PlayerID value in test · b8c8a413
      The default constructor is only allowed to be called on
      API < 32 and the test should use the defined UNSET constant
      to be API independent.
      
      #minor-release
      
      PiperOrigin-RevId: 454568893
      (cherry picked from commit e8bcdf43)
      tonihei committed
    • Ensure `DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION` is always executed · f6b987d8
      `codecDrainAction` is set to `DRAIN_ACTION_NONE` in 3 places in
      `MediaCodecRenderer`:
      * The constructor (so there's no prior state to worry about)
      * `updateDrmSessionV23()`: Where `mediaCrypto` is reconfigured based
        on `sourceDrmSession` and `codecDrmSession` is also updated to
        `sourceDrmSession`.
      * `resetCodecStateForFlush()`: Where (before this change) the action
        is unconditionally set back to `DRAIN_ACTION_NONE` and so any
        required updated implied by
        `DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION` is not done.
      
      This change ensures that `flushOrReleaseCodec()` handles
      `DRAIN_ACTION_FLUSH_AND_UPDATE_DRM_SESSION` before calling .
      
      This probably also resolves Issue: google/ExoPlayer#10274
      
      #minor-release
      
      PiperOrigin-RevId: 454114428
      (cherry picked from commit 222faa96)
      ibaker committed
  2. 09 Jun, 2022 10 commits
    • DefaultTrackSelector: Constrain audio channel count · 0fd24c2f
      The track selector will select multi-channel formats when those can be
      spatialized, otherwise the selector will prefer stereo/mono audio
      tracks. When the device supports audio spatialization (Android 12L+),
      the DefaultTrackSelector will monitor for changes in the platform
      Spatializer and trigger a new track selection upon a
      Spatializer change event.
      
      Devices with a `television` UI mode are excluded from audio channel
      count constraints.
      
      #minor-release
      
      PiperOrigin-RevId: 453957269
      (cherry picked from commit e2f0fd76)
      christosts committed
    • Fix bug: playback is frozen with HLS chunkless preparation · 74fbf017
      This change fixes a bug where the player is frozen with HLS chunkless
      preparation because the audio stream wrappers are not marked as master
      timestamp sources before preparation.
      
      #minor-release
      
      PiperOrigin-RevId: 453941815
      (cherry picked from commit 9221eeb2)
      christosts committed
    • Add session URI to Intent used with the notification · 7c0b787b
      The service handles three different types of `Intents`. Custom command and media
      command Intents created by the library and media button event Intents from other
      sources.
      
      Media commands from the library as well as from external sources have the action
      set to `android.intent.action.MEDIA_BUTTON`. If the data URI is set and can be
      used to identify a session then it is a library Intent. If the Intent is coming
      from an external KeyEvent, the service implementation is asked which session to use
      by calling `onGetSession(controllerInfo)` with the controller info being an
      anonymous legacy controller info.
      
      Intents representing a custom command are always coming from the library and hence
      always have a data URI.
      
      Issue: androidx/media#82
      PiperOrigin-RevId: 453932972
      (cherry picked from commit 8b592fc7)
      bachinger committed
    • Merge pull request #69 from ittiam-systems:rtp_amr_test · 9a73ae90
      PiperOrigin-RevId: 453905355
      (cherry picked from commit 58f7ac25)
      Marc Baechinger committed
    • Add COMMAND_SET_MEDIA_ITEM to Player.Commands · 35691bce
      Some Player implementations have no playlist capability but can still
      set a MediaItem for playback. Examples are a MediaController connected
      to a legacy MediaSession, ExoPlayer up to 2.12 or MediaPlayer.
      
      To indicate this capability, we need an allowed command in addition
      to COMMAND_CHANGE_MEDIA_ITEMS that just allows to set a single item
      that replaces everything that is currently played.
      
      #minor-release
      
      PiperOrigin-RevId: 453879626
      (cherry picked from commit 5333c67d)
      tonihei committed
    • Avoid using ConcurrentHashMap · 35c9585f
      Use Collections.synchronizedSet() instead of creating a set from a
      ConcurrentHashMap because ConcurrentHashMap has a bug in APIs 21/22
      that can result in lost updates.
      
      PiperOrigin-RevId: 453696565
      (cherry picked from commit d506c709)
      christosts committed
    • Audio passthrough: handle unset audio format channel count · 31c7ccbc
      With HLS chunkless preparation, audio formats may have no value
      for channel count. In this case, the DefaultAudioSink will either query
      the platform for a supported channel count (API 29+) or assume a max
      channel count based on the encoding spec in order to decide whether the
      audio format can be played with audio passthrough.
      
      Issue: google/ExoPlayer#10204
      
      #minor-release
      
      PiperOrigin-RevId: 453644548
      (cherry picked from commit 86973382)
      christosts committed
    • Forward legacy controller onPlay/PrepareFromXY calls to onAddMediaItems · f5dc99f5
      These legacy callbacks are currently forwarded to onSetMediaUri which
      will be removed in the future.
      
      Also make sure to only call player.prepare/play after the items have
      been set.
      
      The calls to onAddQueueItem are also forwarded to onAddMediaItems to
      actually allow a session to resolve these items to playable media, which
      wasn't possible so far.
      
      PiperOrigin-RevId: 453625204
      (cherry picked from commit bd126ec5)
      tonihei committed
    • Clarify that `ShuffleOrder` must be consistent in both directions · 926327ef
      #minor-release
      
      PiperOrigin-RevId: 453622964
      (cherry picked from commit 4a6f431f)
      ibaker committed
    • Merge pull request #53 from ittiam-systems:rtp_opus · fd1eb4b4
      PiperOrigin-RevId: 453490088
      (cherry picked from commit a2a45043)
      Marc Baechinger committed
  3. 07 Jun, 2022 6 commits
  4. 31 May, 2022 7 commits
  5. 30 May, 2022 15 commits
    • Update the Gradle Wrapper and Android Gradle Plugin · 711409ab
      The current verion of AGP warns it doesn't support Android API 32 [1].
      
      The wrapper was upgraded with ([instructions](https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:upgrading_wrapper)):
      ```shell
      $ ./gradlew wrapper --gradle-version 7.4.2 --distribution-type all
      ```
      
      [1]
      ```
      WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 32
      
      This Android Gradle plugin (7.0.3) was tested up to compileSdk = 31
      
      This warning can be suppressed by adding
          android.suppressUnsupportedCompileSdk=32
          to this project's gradle.properties
      
          The build will continue, but you are strongly encouraged to update your project to
          use a newer Android Gradle Plugin that has been tested with compileSdk = 32
      ```
      
      #minor-release
      
      PiperOrigin-RevId: 451893214
      (cherry picked from commit 3ba9d7e1)
      ibaker committed
    • Use fluent assertions · 9d460023
      Gives a bit more information upon failures
      
      PiperOrigin-RevId: 451882968
      aquilescanta committed
    • Add constants for custom actions UI customization · 40f5fb55
      PiperOrigin-RevId: 451875964
      bachinger committed
    • Fix release notes typo from `PlaceHolder` to `Placeholder` · a40d3e4c
      The classes were renamed to `PlaceholderXXX` in
      https://github.com/androidx/media/commit/33373d0d0a159ad9c9c3590c838098c4c1530910
      
      #minor-release
      
      PiperOrigin-RevId: 451872006
      ibaker committed
    • Implement session extras for Media3 and legacy controllers · 85a936ec
      This provides an (unstable) API for apps to broadcast session extras
      Bundle to all connected controllers and set the extras in the legacy
      session.
      
      Similar to the custom layout, the extras Bundle is not part of the
      Media3 session state. This means that when a Media3 controller
      connects to the session after the broadcast, the extras needs to be
      sent to that controller in  `MediaSession.Callback.onPostConnect(MediaSession session, ControllerInfo controller)`.
      
      PiperOrigin-RevId: 451871731
      bachinger committed
    • Skip BitrateAnalysisTest if device is incapable. · a629d094
      Add bitrate check to the "can encode" criteria.
      
      PiperOrigin-RevId: 451868042
      claincly committed
    • Add missing tests for custom layout notification · bf3d81c2
      PiperOrigin-RevId: 451859199
      bachinger committed
    • Add a constant for the legacy controller version · 7af9f020
      PiperOrigin-RevId: 451857459
      bachinger committed
    • Remove MediaMetadata.mediaUrl · 581c6b54
      This value only existed to allow setting media URLs from external sources
      (e.g. in a MediaController) so that a player can start playing this item.
      Now that we have MediaItem.RequestMetadata.mediaUrl we can remove this value
      from MediaMetadata because it's request metadata, not media metadata.
      
      PiperOrigin-RevId: 451857413
      tonihei committed
    • Replace MediaItemFiller by asynchronous callback. · 6b782d10
      The MediaItemFiller is not flexible enough for most realworld usages
      because:
       - it doesn't allow asynchronous resolution of MediaItems (e.g. to
         look up URIs from a database)
       - it doesn't allow to batch updates for multiple items or do more
         advanced customizations (e.g. expanding a mediaId representing
         a playlist to multiple items).
      
      Both issues can be solved by passing in a list of items and
      returning a ListenableFuture. The callback itself can also move
      into MediaSession.Callback for consistency with the other
      callbacks.
      
      PiperOrigin-RevId: 451857319
      tonihei committed
    • Improve playlist operation behavior of session test MockPlayer · 342be88d
      The MockPlayer currently:
       - uses separate fields for single mediaItem vs multiple mediaItems
       - replaces all items on addMediaItem operations
       - does nothing on remove/move operations.
      
      Fix all of this by using a single field that replicates the player
      operations directly.
      
      Some tests also need to be updated to make them more realistic
      (for example only removing items from a playlist that have
      previously been added).
      
      PiperOrigin-RevId: 451857271
      tonihei committed
    • Add sessionImpl to PostSessionTask · c814f791
      In some cases it's helpful to have access to the session
      (e.g. to get the PlayerWrapper) from within the PostSessionTask
      implementations. This change forwards the existing sessionImpl
      instance to all these callbacks.
      
      PiperOrigin-RevId: 451857191
      tonihei committed
    • Add RequestMetadata to MediaItem · 6d776a5a
      These fields can be used to transport additional request properties
      when the requester doesn't know the details needed for the actual
      playback (i.e. the LocalConfiguration).
      
      PiperOrigin-RevId: 451857093
      tonihei committed
    • Retain stream time offsets through codecs · b25d00a7
      ExoPlayer applies a large time offset to buffers so that, if the input has negative timestamps, generally buffers seen by the decoders should have positive timestamps. Modify how the offset is handled in `Transformer` so that decoders and encoders generally see positive timestamps, by leaving the offset on samples when reading them in the base renderer (remove the code that removed the offset), and then removing the offset when muxing. Also update the frame processor chain and slow motion flattening code to retain the existing behavior after this change (these both need original media presentation timestamps)
      
      Tested via existing end-to-end tests and manually verified that the overlay frame processor shows the expected original media timestamps.
      
      Aside: we don't need the same logic as ExoPlayer to track stream offsets across the decoder yet, because we don't try to handle stream changes during playback in single asset editing. (There is an edge case of multi-period DASH that may not work but I doubt anyone will use that as input to `Transformer` before we change the code to handle multi-asset properly.) In future we should try to refactor interaction with the decoder to use the same code for Transformer and ExoPlayer.
      PiperOrigin-RevId: 451846055
      andrewlewis committed