1. 24 Jan, 2020 24 commits
    • Remove PlaybackInfo.startPositionUs · e7cdd164
      The only remaining use is to provide the initial position for the first media
      period in the queue. At this point, the value is always equivalent to
      PlaybackInfo.positionUs because they are set together to the same value in
      PlaybackInfo.copyWithNewPosition.
      
      PiperOrigin-RevId: 290749294
      tonihei committed
    • Remove pointless use of playbackInfo.startPositionUs · 2564a121
      We have a flag that gets turned on if the current playback position has been
      reset, so that messages from this reset position can be triggered. This
      mechanism isn't actually depending on the startPositionUs field because it
      should always be triggered in the first iteration with the new position.
      
      PiperOrigin-RevId: 290749201
      tonihei committed
    • Fix a bunch of position problems. · 5f9a5850
      There are a couple of problems with how positions in PlaybackInfo are set at
      the moment:
      1. PositionUs isn't allowed to be C.TIME_UNSET. This is prevented by always
      resolving to the current default position if needed.
      2. In some places a window position was used as a period position. Use correct
      position resolution procedure.
      3. When creating a placeholder position to restart playback, we used the first
      period in a window, not the one where the default position is.
      4. The start position for ads was in some cases set to 0 without checking
      the ad resume position.
      
      PiperOrigin-RevId: 290749042
      tonihei committed
    • MediaCodecAdapter supports queueing input buffers · 665092e4
      Add queueInputBuffer() and queueSecureInputBuffer() in
      MediaCodecAdapter.
      
      PiperOrigin-RevId: 290720307
      christosts committed
    • Adjust `FakeSampleStream#readData` logic. · cf393983
      Once EOS has been read, that will be returned every time readData is called.
      EOS needs to be an item in the items.
      
      PiperOrigin-RevId: 290715513
      samrobinson committed
    • Migrate TtmlDecoderTest to use SpannedSubject · 6923316c
      PiperOrigin-RevId: 290712014
      ibaker committed
    • In-line calls to SpannableStringBuilder.length() in TtmlNode · 4da0d0a4
      This avoids keeping a redundant (and potentially out of sync) copy of
      the same info in builderLength.
      
      PiperOrigin-RevId: 290709360
      ibaker committed
    • Add vertical text support to TtmlDecoder · 3aa52c23
      I needed to use Cue.Builder instead of just SpannableStringBuilder for
      the regionOutput values, so I could attach the vertical info where
      appropriate (since this is a property of the Cue, not a span).
      
      PiperOrigin-RevId: 290709294
      ibaker committed
    • Remove TTML package from null-checking blacklist · 37908dd4
      PiperOrigin-RevId: 290629644
      ibaker committed
    • Ensure timeline and position are updated even if an error occurs · 8a2a5271
      If an exception is thrown between updating the timeline and updating
      the position in playbackInfo, the state may be inconsistent.
      Exceptions are expected to be thrown while updating the player state
      and we should handle such cases in a consistent way.
      
      Similar to how we handle the same situation in seekToInternal,
      the state is updated in a final block such that it gets updated to the
      latest state even if an error occurs. Moving both the timeline and
      position update together also ensures they always stay consistent.
      
      PiperOrigin-RevId: 290624020
      tonihei committed
    • No-op restructure of playlist update handling. · 21c76b01
      This restructure moves all the position resolving code to a static method and
      removes the dependency of the MediaPeriodQueue on having an up-to-date timeline.
      
      Both steps allow simplified reasoning about the code as the static method can't change
      the state of the player, and there is no risk the queue can use the wrong timeline.
      
      These propoerties allow to fix a bug causing inconsistent states in a follow-up step.
      
      PiperOrigin-RevId: 290616395
      tonihei committed
    • Add `FakeSampleStreamItem` to an existing FakeSampleStream. · df41ae3f
      Allows items to be added to the queue once the sample stream has already been created.
      Means tests can simulate data not all being available at the start.
      
      PiperOrigin-RevId: 290613392
      samrobinson committed
    • Add default to switch in TtmlDecoder · 04d32533
      Also de-dupe a couple of case statements
      
      PiperOrigin-RevId: 290610993
      ibaker committed
    • Fix warning about adjacent overload methods in TtmlStyle · 9cfc75ff
      PiperOrigin-RevId: 290610936
      ibaker committed
    • Remove CEA package from null-checking blacklist · f7470c51
      PiperOrigin-RevId: 290610312
      ibaker committed
    • Delete TtmlStyle#inheritableStyle · de3f04b7
      It's never assigned or accessed from outside the class.
      
      It was added in
      <unknown commit>
      then the accessor was removed in
      <unknown commit>
      
      PiperOrigin-RevId: 290601998
      ibaker committed
    • Remove duplicate release note · 0aa47c23
      PiperOrigin-RevId: 290600248
      andrewlewis committed
    • Move MpegAudioHeader to MpegUtil · ea69a3db
      This makes MPEG audio utilities similar to utilities we have for WAV,
      AC-3 etc., and moves them out of the extractor package so that an
      extractor module can be split out without needing to have a class in the
      extractor package in the common library.
      
      PiperOrigin-RevId: 290595089
      andrewlewis committed
    • Add ID3 genres added in Wimamp 5.6 (2010). · 5e2b4117
      All these genres are currently causing a warning and are not added to the Metadata.Entry.
      
      PiperOrigin-RevId: 290594810
      tonihei committed
    • Rollback of https://github.com/google/ExoPlayer/commit/72437e44424c8b0049c21842d08e9719e529d5b0 · 747ae641
      *** Original commit ***
      
      Rollback of https://github.com/google/ExoPlayer/commit/ff89170b008b8b3438b7c002a156fbfb41c05174
      
      *** Original commit ***
      
      Fix some logic in AnalyticsCollector.
      
      All events issued from ExoPlayerImpl (i.e. Player.EventListener events) currently
      try to use the media period data from the playing media period as set in the
      playback thread queue. This is only correct as long as there no pending masking
      operations in ExoPlayerImpl. That's why we currently disable this whenever the timeline
      is...
      
      ***
      
      PiperOrigin-RevId: 290593700
      tonihei committed
    • extensions/av1: use -O2 for release builds · d899e1fc
      + force arm (over thumb) mode for 32-bit builds
      
      -O2 improves performance ~30-40% over the default -Oz depending on the
      resolution; this is similar to what is done for vp9 which uses -O3.
      
      PiperOrigin-RevId: 290318121
      olly committed
    • Rollback of https://github.com/google/ExoPlayer/commit/ff89170b008b8b3438b7c002a156fbfb41c05174 · 72437e44
      *** Original commit ***
      
      Fix some logic in AnalyticsCollector.
      
      All events issued from ExoPlayerImpl (i.e. Player.EventListener events) currently
      try to use the media period data from the playing media period as set in the
      playback thread queue. This is only correct as long as there no pending masking
      operations in ExoPlayerImpl. That's why we currently disable this whenever the timeline
      is empty or a seek is pending. Since adding all the playlist API methods to the player,
      this is no longer the right choice. Moreover,...
      
      ***
      
      PiperOrigin-RevId: 290312118
      bachinger committed
    • Ensure tracks in PlaybackInfo are always in sync with position. · 4cf614c6
      Currently both are updated by separate setters. If an exception is thrown between
      the two setters, the state may not be consistent.
      
      Avoid this problem by always setting them together.
      
      PiperOrigin-RevId: 290293600
      tonihei committed
    • Fix some logic in AnalyticsCollector. · ff89170b
      All events issued from ExoPlayerImpl (i.e. Player.EventListener events) currently
      try to use the media period data from the playing media period as set in the
      playback thread queue. This is only correct as long as there no pending masking
      operations in ExoPlayerImpl. That's why we currently disable this whenever the timeline
      is empty or a seek is pending. Since adding all the playlist API methods to the player,
      this is no longer the right choice. Moreover, we don't have a definite API that tells
      AnalyticsCollector when a playlist API call has been handled (and we don't want to
      have one).
      
      We can fix this by always using the current Player position information as the source
      of truth (instead of the media period queue). This is definitely more correct and also
      works while a masking operation is pending. To fill in the additional information from
      the media period queue, we can look up a matching media period. This may not be the
      first one in the list if an operation is pending.
      
      The new methods are similar to the previous tryResolveWindowIndex method, but:
       1. They are always used (i.e. the current Player state is the main source of truth)
       2. They also check the correct ad playback state, that was just ignored previously.
      
      PiperOrigin-RevId: 290284916
      tonihei committed
  2. 17 Jan, 2020 7 commits
  3. 16 Jan, 2020 9 commits
    • HLS: Fix slow seeking into long MP3 segments · 2859a340
      Issue: #6155
      PiperOrigin-RevId: 290117324
      olly committed
    • FlacExtractor: handle case where last frame < MAX_FRAME_HEADER_SIZE · db750125
      PiperOrigin-RevId: 290079840
      kimvde committed
    • Tunneling timestamp use Message instead of Runnable · a99ab622
      This avoids allocating a Runnable.
      
      PiperOrigin-RevId: 290079660
      krocard committed
    • Start service in foreground if allowed · cb8391a5
      This fixes an issue where a DownloadService implementation
      that allows foreground but doesn't provide a scheduler would
      not be restarted in the case that it was still in memory but
      classed as idle by the platform.
      
      It also speeds up service restart in the case that a
      scheduler is provided.
      
      Issue: #6798
      PiperOrigin-RevId: 290068960
      olly committed
    • Split SampleQueue.advanceTo for advance & seek use cases · 775a17c4
      This method has two use cases:
      
      1. Seeking. Calls are immediately preceded by a call to rewind(), and
         the returned value isn't important unless it's ADVANCED_FAILED (i.e.
         the caller is only interested in success and failure).
      2. Advancing. The return value is important unless it's ADVANCED_FAILED,
         in which case the caller wants to treat it as 0.
      
      This change creates separate methods for each use case. The new seekTo
      methods automatically rewind and return a boolean. The updated advanceTo
      method returns 0 directly in cases where ADVANCED_FAILED was returned.
      Arguments that were always hard-coded to true by callers have also been
      removed.
      
      This change is a step toward one possible solution for #6155. How we'll
      solve that issue is still up for discussion, but this change seems like
      one we should make regardless!
      
      Issue: #6155
      PiperOrigin-RevId: 290053743
      olly committed
    • Fix DownloadService resumption · 51f2723b
      - DownloadManagerHelper now passes all downloads to the
        DownloadService when the service is attached (and once
        the downloads are known). The service then starts the
        foreground notification updater if necessary. This fixes
        the ref'd issue.
      - Don't call getScheduler() if the service is background
        only. This was already documented to be the case on the
        DownloadService constructor.
      - If the service is started in the foreground on SDK level
        26 and higher, satisfy the condition to move the service
        to the foreground in onStartCommand rather than in stop().
        It's much more obviously correct, and should produce the
        same end result.
      
      Issue: #6798
      PiperOrigin-RevId: 290050024
      olly committed
    • Merge pull request #6603 from TiVo:fix-tunneling-stuck-release · 1ec05199
      PiperOrigin-RevId: 290041295
      Oliver Woodman committed
    • Reorder renderer changes at period transitions · 2e7978a0
      Currently the following sequence of events happens at automatic period transitions:
      1. Update queue (=release old playing period)
      2. Disable unused renderers
      3. Enable newly needed renderers
      
      This order requires difficult to follow workarounds in AnalyticsCollector for all
      events related to step 2 (disable renderers). The current media period has already
      been advanced so can't be used. The current workaround saves the last known playing
      media period that was published as part of a PlaybackInfo update in ExoPlayerImpl.
      This works in most cases, but is inherently wrong because the published state in
      ExoPlayerImpl may be completely unrelated to the updates happening on the playback
      thread (e.g. if many other operations are pending).
      
      Simplify and fix this problem by changing the order of the events above:
      1. Disable unused renderers.
      2. Update queue
      3. Enable newly needed renderers.
      This way the current playing media period can be used for both renderer disable
      and renderer enable events, thus it's correct in all cases and the workaround
      in AnalyticsCollector can be removed.
      
      PiperOrigin-RevId: 290037225
      tonihei committed
    • Fix setting maskingPeriodIndex in ExoPlayerImpl · 8d2fd383
      Whenever we set the maskingWindowIndex, we also need to set the masking period index
      and the masking position. Otherwise it may cause exception when the period index
      is used together with the masking timeline.
      
      PiperOrigin-RevId: 290036973
      tonihei committed