In some occasions, we may want to discard a part of the buffered media to
improve playback quality. This CL adds this functionality by allowing the
loading media period to re-evaluate its buffer periodically (every 2s) and discard
chunks as it needs.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177958910
FakeRenderer only needs to allocate real memory because it extends BaseRenderer
which uses the actual SampleStream implementation. Immediately release the
memory after using it to prevent excessive memory usage when running fast
simulations.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177949628
This is in line with a recent change in ExoPlayerImplInternal. Not discarding the buffer
causes OOM when running simulated playbacks.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177573930
Calling it directly might skip other callbacks. For example:
ActionSchedule.Builder().waitForTimelineChanged(...).build().
is currently immediately calling through to
callback.onActionScheduleFinished when the timeline changes.
Depending on the position of the action schedule listener in the
listener set, it may skip other listeners also
listening to timeline changes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177442975
Some streams don't have the new video resolution in the primary format.
Use the subsequent call to videoListener.onVideoInputFormatChanged to
resolve this unknown resolution.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177433618
This allows to keep the state synced with ExoPlayerImpl after stopping the player,
but still releases the media source immediately as it needs to be reprepared.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177167980
The ExoPlayerImpl implementation forwards the stop request with this optional
parameter. To ensure correct masking (e.g. when timeline updates arrive after
calling reset in ExoPlayerImpl but before resetInternal in
ExoPlayerImplInternal), we use the existing prepareAck counter and extend it
also count stop operations. For this to work, we also return the updated
empty timeline after finishing the reset.
The CastPlayer doesn't support the two reset options so far.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177132107
Unconditionally waiting for the action schedule to finish in ExoPlayerTestRunner
doesn't work if the action schedule is not intended to be finished.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177024139
A message to stop the playback and to quit the playback thread was posted in release().
The stop message removed all other already queued messages which might include
the second message to quit the thread. That led to infinite waiting in the
release method because the playback thread never got the quit signal.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176997104
Fixed by explicitly waiting for the timeline update. This shouldn't be
necessary and will be removed as soon as the correct order of events
can be guaranteed (timeline change -> state change -> onSeekProcessed).
The waiting for the timeline update is implemented by introducing the
feature that the test runner also waits until the action schedule has
finished before stopping the test.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176848540
In a test run where no exceptions were thrown on the main thread and the test
did not time out, exceptions from onPlayerError were not correctly propagated to
the test thread (handleException would be called with null).
Fix ExoPlayerTestRunner.onPlayerError to propagate the actual exception from the
player.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176825907
This is mostly useful for suppressing the initial position
discontinuity reported by ClippingMediaPeriod.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176758972
This brings ClippingMediaSource clip failures in line with
what MergingMediaSource does when it cannot merge.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176660123
This allows implementations of those classes to take into account the playback
speed for adaptive track selection and controlling when to resume the player.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176484361
Currently testRunner.blockUntilEnded waits for the first transition to
STATE_ENDED or _IDLE before returning. In order to support tests with
player repreparations after one playback finished, this change adds an
option to specifiy the number of expected transitions to ended.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176484047
The initial period index was counted in onPlayerStateChanged. However, we
actually want to save the period index in the newly introduced onPositionDiscontinuity
after preparation.
While being here, also updated deprecated LinkedList to ArrayList.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176479509
Currently onTimelineChanged doesn't allow to distinguish easily between the
different reasons why it's being called. Especially, finding
out whether a new media source has been prepared or the current source
refreshed dynamically was impossible without tightly coupling the player
operations with the listener.
The new reasons provide this disdinction by either indicating a newly
initialized media source, a dynamic update to an existing timeline
or manifest, or a reset of the player (which usually results in an
empty timeline).
The original onTimelineChanged method without reason is kept in the
DefaultEventListener as deprecated to prevent the need to update all
existing listeners in one go.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176478701
- Properly report internal discontinuities
- Add DISCONTINUITY_REASON_SEEK_ADJUSTMENT to distinguish
seek adjustments from other internal discontinuity events
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176367365
- MediaSourceTestRunner aims to encapsulate some of the logic
currently used in DynamicConcatenatingMediaSourceTest, so it
can be re-used for testing other MediaSource implementations.
- The change also fixes DynamicConcatenatingMediaSourceTest to
execute calls on the correct threads, and to release handler
threads at the end of each test.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176117535
This is helpful for tests which don't care about detailled timeline set-ups
besides the number of windows.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176097369
The purpose of this change isn't to fix anything. It's just to
simplify things a little bit. There will be following CLs that
make some changes to get things onto correct threads.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175800354
This allows to remove the LazyMediaSource used within
DynamicConcatenatingMediaSourceTest and also allows to write test which
simulates dynamic timeline or manifest updates.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175680371
Also added tests which verify the intended behaviour.
GitHub:#3452
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175656478
Add onEnable() and onDisable() call-backs to TrackSelection. This allows
TrackSelection to perform interesting operations (like subscribe to
NetworkStatus) and clean up after itself.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175558485
Someone must have forgotten to do this when rewriting this class.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175296249
- 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
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
The chunk size of real video data varies around the given average bitrate.
To account for this fact in the fake adaptive data set, the chunk size varies
randomly with a given standard deviation. The standard deviation used for the
BandwidthProfileSimulator is based on the chunk size variation measured on the
1 hour playlist of real media.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172068110
This change fixes various issues:
- MobileHarness sometimes allocated devices with SDK < 16. As we have no tests running
on these SDKs, a new dimension filter for the mobile_test target ensures that only
devices with SDK >= 16 are selected. A similar filter for SDK version is also added
to the ABR playback tests to ensure no old devices are selected.
- DRM specific tests are skipped for Api < 18, but were not able to run because the
DashTestRunner class tried to link to the MediaDrm constructor. Moved the
constructor to a seperate Builder class to allow execution on Api levels 16 and 17.
- DashWidevineOfflineTest also tried to access code for Api >= 18 without checking
the current level.
- Action implementations which are waiting for events did not ensure that they have a
nextAction to wait for. This caused NullPointerExceptions when this next action was
scheduled.
- DefaultDrmSession always restored the offline keys when a new license was requested,
even if the keys were already restored. These repeated slow calls to restoreKeys
resulted in high numbers of dropped buffers.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171974859
Calling HandlerThread.quit() or .quitSafely() doesn't immediately terminate
the thread. It just instructs the Looper not to accept any new messages and
to terminate at the next opportunity. Added a HandlerThread.join() everywhere
where the intention is to close and release all resources and to stop all
threads.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171525241
Now this counter includes input buffers too, which are dropped as part of
skipping to keyframes for catch up.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171119930
This allows more deterministic action schedules, especially for real media
which may take an arbitrary amount of time to rebuffer after seeking.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171005231
If the current output buffer is very late and the playback position is in a
later group of pictures, drop all buffers to the keyframe preceding the
playback position.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170975259
Run next action immediately without using the handler when the requested
delay is zero. This ensures that no other code can run between these two
actions to improve deterministic test behaviour.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170456852
This change allows applications to provide custom AudioSinks, which could be
based on android.media.AudioTrack like AudioTrackAudioSink, or could be
completely custom.
The refactoring is mostly mechanical and shouldn't result in any functionality
changes.
Some android.media.AudioTrack-specific details have to appear in the AudioSink
interface so this change modifies the javadoc on the AudioTrack (now AudioSink)
to note that some methods will have no effect.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170311083