Instead of using an Executor to run DownloadTasks creates and manages
threads internally.
Also added DownloadThread internal class to better separate the code
that doesn't run on the main thread.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174036872
1. Move Timeline/Manifest into PlaybackInfo
2. Don't update externally visible Timeline/Manifest during preparation
3. Ignore MSG_POSITION_DISCONTINUITY during preparation
4. Correctly set masking variables at start of preparation, and use them
Once this change goes in, PlaybackInfo will contain timeline, manifest
and position, which should always be self-consistent with one another.
The next step would then be to move a bunch of logic in ExoPlayerImpl
that derives state from timeline and position into PlaybackInfo, and
split that into its own top level class that can be easily tested to make
sure it never IndexOutOfBounds.
I think we could also replace the masking variables and instead just assign
a new PlaybackInfo to the playbackInfo variable whenever we're doing
something that requires masking. This should be possible because we no
longer update playbackInfo whenever we have pending acks. It would
require allowing PlaybackInfo to mask the window position internally when
the timeline is empty, but I think this is ok, and again is something we
could test pretty easily.
Issue: #3362
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173909791
This makes it a bit more obvious what's going on during
preparation. In particular, it makes it clear that
MSG_SOURCE_INFO_REFRESHED arrives before MSG_TRACKS_CHANGED.
Issue: #3362
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173392080
Also switch from using MIME types to C.ENCODING_* encodings in DefaultAudioSink.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173379623
We don't expect this case to occur, since track selection is
normally expected to check canAcquireSession before selecting
a track. Nevertheless, if an attempt is made to acquire a
session when the media doesn't support the manager's UUID, we
should fail in a more graceful way.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173124170
Other catch blocks in this class catch everything. This one should
too.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173118891
Tasks conflict if both of them work on the same media and at least one
of them is remove action.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172741795
We have been using USE_CHORD_PITCH == false for a while and the quality of
pitch changes seems fine. It's now possible to set the sample rate too, but
this only works if USE_CHORD_PITCH is false, so remove the constant.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172736631
- When transitioning to a new period, the value of bufferedDurationUs
passed to TrackSelection.updateSelectedTrack was incorrectly set to
0. It should have been set to correctly reflect buffered media in
previous periods still being played out.
- This change fixes the issue described above, and also propagates the
playback position through to this method. The position of the next
load within the period can be calculated by adding the position and
bufferedDurationUs.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172736101
If connecting a Bluetooth audio device fails, the AudioTrack may be left in a
bad state, where it is not actually playing and its position has jumped back to
zero. Detect and work around this case by resetting the track.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172600912
prepare and selectTracks receive the position from which any
loading should start, where-as continueLoading receives the
actual playback position. These are different in the case that
a previous period is still being played out.
Also removed "relative to the start of the period" from prepare
documentation because it couldn't really be relative to anything
else.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172592769
newPlayingPeriodHolder could be set then updated if seeking to a repeated period
that was loaded more than once. This led to MediaPeriodHolders leaking.
Only set newPlayingPeriodHolder once so that any later holders with the same
period identifier get released.
Also add a regression test. FakeMediaSource checks that all created
MediaPeriods were released when it is released.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172591937
This is not really useful with the DefaultAudioSink, but could be used in a
custom AudioSink when mixing audio from sources that have different sample
rates.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172434482