18772 Commits

Author SHA1 Message Date
jbibik
b9cc70d9e2 Fixed spelling across various PlayerInfo *ChangeReason fields
PiperOrigin-RevId: 541892788
2023-06-22 15:23:21 +00:00
tonihei
e0191ddded Fix spurious sessions created for events after the playlist is cleared
Some events may arrive after the playlist is cleared (e.g. load
cancellation). In this case, the DefaultPlaybackSessionManager may
create a new session for the already removed item.

We already have checks in place that ignore events with old
windowSequenceNumbers, but these checks only work if the current
session is set (i.e. the playlist is non-empty). The fix is to add
the same check for empty playlists by keeping note of the last
removed window sequence number.

PiperOrigin-RevId: 541870812
2023-06-20 14:08:06 +01:00
ibaker
71f73229dd Fix two more unresolved SVGs in Timeline.Window and Timeline.Period
These were missed in 10342507f7

#minor-release

PiperOrigin-RevId: 541860649
2023-06-20 14:06:02 +01:00
claincly
4cb5f38007 Increase pixel difference
PiperOrigin-RevId: 541860433
2023-06-20 14:05:07 +01:00
samrobinson
125c39eec3 Use AudioFormat within SilenceAudioGenerator.
PiperOrigin-RevId: 541856580
2023-06-20 14:04:06 +01:00
tonihei
2ac5d8f1af Make FakeClock Espresso and Compose UI test compatible
FakeClock currently doesn't work well with Espresso and Compose UI
tests because view interactions in both frameworks intentionally idle
the main looper to handle pending UI effects. However, this also
advances playback progress even though we want to deterministically
trigger progress from the test itself.

To solve this problem, we can detect the idling Robolectric call and
postpone any further updates until we leave this state.

PiperOrigin-RevId: 541831050
2023-06-20 14:03:06 +01:00
Googler
abd1c006fc Player.Listener implementation to resolve playback suppression on Wear.
Add a Wear OS specific implementation of 'Player.Listener' to help resolving the playback suppression due to unsuitable output by launching a system media output switcher dialog.

PiperOrigin-RevId: 541698125
2023-06-20 14:02:05 +01:00
sheenachhabra
911a6430f3 Remove UdtaInfo class
The class seems unnecessary and the code can be simplified by
removing this.

PiperOrigin-RevId: 541675378
2023-06-20 14:00:50 +01:00
samrobinson
74948d5424 Add a constructor for AudioFormat that takes Format.
PiperOrigin-RevId: 541662208
2023-06-20 13:59:47 +01:00
ibaker
69769c77b3 Clear buffer's timeUs when setting end-of-stream in SampleQueue
PiperOrigin-RevId: 541657834
2023-06-20 13:58:29 +01:00
samrobinson
6d648f8bdb Add dump tests for concatenating 2 audio items.
Audio only tests are now using RAW audio where possible, which is
passed through the Robolectric decoders/encoders, and can be handled by
the AudioProcessor instances accurately.

PiperOrigin-RevId: 541648853
2023-06-20 13:57:33 +01:00
bachinger
8d8c514d12 Fix bug where PlayerView distorts video when video size is unknown
PiperOrigin-RevId: 541640959
2023-06-19 16:30:23 +01:00
huangdarwin
949e9cbd96 GL: Rename GL methods.
To more accurately describe what they do, especially as Compositor will
starts to use more contexts or threads, and it's important to know what
needs to be reset/recreated/focused before what methods.

PiperOrigin-RevId: 541010135
2023-06-19 16:29:03 +01:00
sheenachhabra
c0e8513b7a Make dump files deterministic
Issue: When running the Transformer related test cases, the tests are flaky
because the order in which audio and video samples are interleaved seems to
differ in few instances.

Root cause: When running a transformation the sample producer (Asset loader)
and sample consumer (Sample pipeline) both runs on different thread and
theoretically there is no reason for behaviour to be deterministic because
the number of samples produced/written depends on how fast individual thread
works. So it is indeed surprising that test somehow worked deterministically in
majority of instances (may be something to do with Robolectric environment).

Solution: Since we don't expect the order of sample interleaving to be deterministic, make the dumping logic deterministic where all the video
samples will be collected and then dumped together (similarly for audio). This would mean we won't be able to see the interleaving so for that we need to
add separate test case verifying the interleaving logic only.

Pending: Test case for interleaving.
PiperOrigin-RevId: 540930871
2023-06-19 16:28:07 +01:00
huangdarwin
daa42322d7 GL: Remove configAttributes from createFocusedPlaceholderEglSurface.
PiperOrigin-RevId: 540901189
2023-06-19 16:27:02 +01:00
Marc Baechinger
af69d5822a Merge pull request #436 from jaeho-lee104:feature/improve_condition
PiperOrigin-RevId: 540875285
2023-06-19 16:25:40 +01:00
claincly
fe33f0e390 Simplify EOS signaling in DefaultVideoFrameProcessor
Previously, TextureMangers have a method to signal ending of a current input
stream, and a method to end the **entire input**. The responsibility of both
methods are not easy to document, understand and read.

With the new design,

- Only `TextureManager.signalEndOfCurrentInputStream()` is kept
  - It's called for every MediaItem in the sequence, include the final one
- FinalWrapper now takes explicit signal that frame processing is ending,
  rather than relying on the return value of `onCurrentInputStreamProcessed()`
- On DVFP receiving EOS from the pipeline, it signals FinalWrapper the stream
  is ending, **before** signaling the input switcher, so that FinalWrapper is
  able to end the stream when the onCurrentInputStreamEnded signal eventually
  reaches FinalWrapper

PiperOrigin-RevId: 540856680
2023-06-19 16:24:33 +01:00
claincly
0d3082e6ad Reduce the pixel differnce in TransformerSequenceEffectTest
As the test images are re-gened on the emulators.

PiperOrigin-RevId: 540851288
2023-06-19 16:23:13 +01:00
huangdarwin
4178d61ccd Effect: Move VideoFrameProcessingTask to VFPTaskexecutor
Group things that are closely related. VFPTask is only ever
used alongside VFPTaskExecutor.

PiperOrigin-RevId: 540850948
2023-06-19 16:22:09 +01:00
tofunmi
251fb013c3 Reset the simple frame dropping logic on flush or EOS.
#minor-release

PiperOrigin-RevId: 540633875
2023-06-19 16:20:09 +01:00
rohks
be9b057dda Refactor method CmcdLog.createInstance to accept bufferedDurationUs
Instead of providing `playbackDurationUs` and `loadPositionUs` individually, which are used to calculate the buffer duration for CMCD logging, we can directly pass the pre-calculated `bufferedDurationUs` available in the `getNextChunk` method of the chunk source classes.

Issue: google/ExoPlayer#8699

#minor-release

PiperOrigin-RevId: 540630112
2023-06-19 16:19:04 +01:00
sheenachhabra
18bc893210 Remove copying sample data in Mp4Muxer
PiperOrigin-RevId: 540623370
2023-06-19 16:18:09 +01:00
rohks
52878b2aca Add CMCD logging when requesting initialization chunk for DASH and HLS
Additionally, two existing methods to `buildDataSpec` in `DashUtil` have been deprecated, while a new method has been added that allows the inclusion of `httpRequestHeaders`.

Issue: google/ExoPlayer#8699

#minor-release

PiperOrigin-RevId: 540594444
2023-06-19 16:17:16 +01:00
ibaker
8bf40e7355 Add a demo app sample of SubRip muxed into MKV
I created this by:
1. Downloading https://storage.googleapis.com/exoplayer-test-media-1/mkv/android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv
2. Crafting a `test.srt` file with a text editor
3. Muxing them together:

   ```
   $ mkvmerge -o android-screens-with-subrip.mkv \
       android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv \
       test.srt
   ```

Tested in the demo app, the subtitle track is selected by default
(default behaviour for Matroska spec afaict).

PiperOrigin-RevId: 540577912
2023-06-19 16:15:43 +01:00
samrobinson
1236d37acb Improve SequenceExportTest test and dump file naming.
No-op change to highlight when video and/or audio are transmuxed and
reorder the methods.

PiperOrigin-RevId: 540567375
2023-06-19 16:14:38 +01:00
jbibik
501da109ce Default RepeatMode for conversion is NONE/OFF
Current behaviour causes an app to crash if it receives an unrecognized repeat mode send over the wire. In order to avoid the crash, a sensible default had to be chosen.

For `Player.RepeatMode`, it is `Player.REPEAT_MODE_OFF`, which is the same value we use as default when unbundling `PlayerInfo`.

For `PlaybackStateCompat.RepeatMode`, it is `PlaybackStateCompat.REPEAT_MODE_NONE`, which is what we use in the no-arg `LegacyPlayerInfo` constructor.

Issue: androidx/media#448

#minor-release

PiperOrigin-RevId: 540563792
2023-06-19 16:13:39 +01:00
Googler
42915e9a58 Rename the APIs for playback suppression due to unsuitable output.
The APIs /related fields for playback suppression due to unsuitable output should be renamed from '..SuppressPlaybackWhenNoSuitableOutputAvailable' to '..SuppressPlaybackOnUnsuitableOutput'

PiperOrigin-RevId: 540555715
2023-06-19 16:12:33 +01:00
ibaker
3ce6c06169 Rollback of 45d35c5d78
*** Original commit ***

Suppress warnings in preparation for Checker Framework version 3.34.0-eisop1

***

PiperOrigin-RevId: 540539608
2023-06-19 16:11:42 +01:00
huangdarwin
5fc5105f7a Test: Log saved bitmap file path.
This helps debug bitmap tests. Without this CL, I typically
need to go into the file to find the test name and absolute
path. With this CL, I can just adb pull the printed file path,
which is much simpler.

PiperOrigin-RevId: 540539042
2023-06-19 16:10:30 +01:00
bachinger
bd97dd8519 Rollback of 7956c80f73
*** Original commit ***

Rollback of 2a6f893fba

*** Original commit ***

Set video size to 0/0 when video render is disabled

In terms of MCVR wi...

***

PiperOrigin-RevId: 540525069
2023-06-19 16:09:13 +01:00
tonihei
51fb72b00d Replace deprecated NullableType from checkerframework with our own one
The existing NullableType has been deprecated 5 years ago and causes
crashes in Kotlin apps because Kotlin doesn't recognize this annotation
as a nullable type annotation.

While we can't align on a single @Nullable annotation yet, we can at
least replace this one by JSR305's @Nonnull(MAYBE) as it fulfils all
requirements, including full Kotlin compatiblity. To avoid the
cumbersome name, we can redefine it as our own @NullableType
annotation. (We can't use @Nullable to avoid name clashes with the main
@Nullable annotation from AndroidX)

Issue: google/ExoPlayer#6792
PiperOrigin-RevId: 540497469
2023-06-19 16:08:20 +01:00
ibaker
567890da9e Remove = from parameter args in call to Constructor.newInstance
These comments reflect the parameter names of the constructor that
we're reflectively calling, but errorprone complains that they don't
match the parameter names of `Constructor.newInstance`.

PiperOrigin-RevId: 540348118
2023-06-19 16:07:18 +01:00
jaeholee104
43d1bfe11a Improve track index adjustment logic by adding index comparison. 2023-06-16 10:16:50 +00:00
siroberts
cf21add916 Add missing checkNotNull to bitmapLoader.
#minor-release

PiperOrigin-RevId: 540309118
2023-06-14 20:47:04 +01:00
bachinger
3d674fa2f3 Implement equals/hashCode for CommandButton
#minor-release

PiperOrigin-RevId: 540274932
2023-06-14 20:45:36 +01:00
sheenachhabra
d0eda433ea Replace CreationTime class with Mp4TimestampData class
PiperOrigin-RevId: 540257484
2023-06-14 20:42:36 +01:00
ibaker
248d1d99ec Stop suppressing exceptions in MediaCodec.Callback during flush
Previously `AsynchronousMediaCodecCallback.mediaCodecException` was
cleared when flushing completed. This behaviour was changed in
aeff51c507
so now the exception is not cleared.

The result after that commit was that we would **only** suppress/ignore
the expression if a flush was currently pending, and we would throw it
both before and after the flush. This doesn't really make sense, so this
commit changes the behaviour to also throw the exception during the
flush.

This commit also corrects the assertion in
`flush_withPendingError_resetsError` and deflakes it so that it
consistently passes. The previous version of this test, although the
assertion was incorrect, would often pass because the
`dequeueInputBuffer` call would happen while the `flush` was still
pending, so the exception was suppressed.

#minor-release

PiperOrigin-RevId: 540237228
2023-06-14 20:41:10 +01:00
tonihei
b69b33206e Mark output sample as decode-only based on start time
We currently do the same check on the input timestamps and
expect the output timestamps to match. Some codecs produce
samples with modified timestamps and the logic is a lot safer
when the comparison with the start time is done on the output
side of the codec.

Issue: google/ExoPlayer#11000
PiperOrigin-RevId: 540228209
2023-06-14 20:39:49 +01:00
claincly
aa94f4e128 Add a blank line to break long paragraph
PiperOrigin-RevId: 540222936
2023-06-14 20:38:24 +01:00
tonihei
c76680a65c Add missing @Override
PiperOrigin-RevId: 540220141
2023-06-14 20:35:57 +01:00
claincly
abd96598d9 Add a timer to end a video stream prematurely in ExtTexMgr
Partially roll forward of 5c29abbbf4, and adds some extra logic

Changes to the original CL

The original logic (a66f08ba97) fails in the following case:

> This is only seem on emulators.

- EOS is sent to ExtTexMgr
- The timer starts
- One frame arrives on SurfaceTexture, reset the timer
  - The frame is sent for processing, now `availablFrames == 0`
- One frame arrives on Surface, reset the timer
  - The frame is kept on SurfaceTexture for the downstream shader doesn't have
    capacity, `availablFrames == 1`
- Timer times out as the downstream processor doesn't report being able to take
  another frame.
  - Although there's a frame available on the SurfaceTexture

This is solved by having the force EOS logic clear all the frames that the
SurfaceTexture holds. This also ensures the first frame dequeued from the next
stream isn't from the previous stream.

PiperOrigin-RevId: 540023359
2023-06-14 20:34:17 +01:00
jbibik
4b5a457790 Notify listeners of error changes when masking in MediaControllerImplBase
Currently, the implementation of `MediaControllerImplBase` differs from `ExoPlayerImpl`. The listeners of the former are notified of player error changes only in `onPlayerInfoChanged` and not `updatePlayerInfo` (masking method). Whereas `ExoPlayerImpl` has one unified method - `updatePlaybackInfo` - which sends the events to all the available listeners.

This change fixes the lack of 2 particular callbacks - `onPlayerErrorChanged` and `onPlayerError`, however, there might be more differences. Ideally, there should be a unified method for oldPlayerInfo/newPlayerInfo comparison-update-notify-listeners flow.

Issue: androidx/media#449

#minor-release

PiperOrigin-RevId: 539961618
2023-06-14 20:32:55 +01:00
bachinger
5afe7552fe Document how to use a custom receiver app with the cast demo
#minor-release
Issue: androidx/media#452
PiperOrigin-RevId: 539915277
2023-06-14 20:30:32 +01:00
cushon
45d35c5d78 Suppress warnings in preparation for Checker Framework version 3.34.0-eisop1
More information: go/checker-lsc

Tested:
    TAP --sample ran all affected tests and none failed
    http://test/OCL:539686832:BASE:539663180:1686589466563:d12d5eb7
PiperOrigin-RevId: 539887073
2023-06-14 20:29:07 +01:00
claincly
5961637c0a Add test for per-MediaItem effect
The test transcodes four media items with distinct effects, keeping one frame
each; extracts the four frames in the produced video, and compares them against
the expected results.

PiperOrigin-RevId: 539697344
2023-06-14 20:27:37 +01:00
ibaker
959e974138 Release ExoPlayer instances in ExoPlayerTest
This was recommended in https://github.com/robolectric/robolectric/issues/8187#issuecomment-1552060094

PiperOrigin-RevId: 539691757
2023-06-14 20:25:53 +01:00
tofunmi
4bceb64dee Version bump to media3:1.1.0-rc01
#minor-release

PiperOrigin-RevId: 539632164
2023-06-12 14:14:33 +00:00
tofunmi
03745de432 Change the rc release date
#minor-release

PiperOrigin-RevId: 539628823
2023-06-12 14:13:15 +00:00
bachinger
c2f78db87e Clean up HLS sample for cast demo
Issue: androidx/media#452
#minor-release
PiperOrigin-RevId: 539613535
2023-06-12 14:11:36 +00:00
claincly
4b1ac2f172 Factor out video decoding and fix two minor issues
1. Not treating 0 as valid buffer index
2. Not handling the case the last frame is a comparison frame

PiperOrigin-RevId: 539607482
2023-06-12 14:09:48 +00:00