11361 Commits

Author SHA1 Message Date
christosts
65d8ff80db ForwardingPlayer only forwards Player operations
PiperOrigin-RevId: 374621615
2021-05-19 20:24:53 +01:00
krocard
41afb6ac4e Add guarantied invalid command to allow niche optimisations
This allows users to use `int` to store an optional command.

PiperOrigin-RevId: 374600127
2021-05-19 20:24:29 +01:00
claincly
e383b0031d Define the default RTSP character set.
#minor-release

PiperOrigin-RevId: 374433331
2021-05-19 20:24:04 +01:00
aquilescanta
66c1aedeb3 Assign ERROR_CODE_BEHIND_LIVE_WINDOW to BehindLiveWindowExceptions
PiperOrigin-RevId: 374425179
2021-05-19 20:23:38 +01:00
ibaker
73f28d4829 Fix core_settings.gradle to not assume exoplayerRoot is absolute
Gradle warns against passing a relative path to `new File(String)`:
https://docs.gradle.org/current/userguide/working_with_files.html#sec:single_file_paths

This change fixes all usages of `exoplayerRoot` to pass it to Gradle's
`Project.file()` first, which returns an absolute `File`.

To reproduce the problem in Issue: #8927:
1. Checkout ExoPlayer git project, to e.g. `~/ExoPlayer/exoplayer-git`
2. Create a new Android Studio project in e.g. `~/AndroidStudioProjects/exoplayer-test`
3. Edit the new project's `settings.gradle` file as described in
   https://github.com/google/ExoPlayer/blob/release-v2/README.md
   using a relative path for `exoplayerRoot`:
   ```
   gradle.ext.exoplayerRoot = '../../ExoPlayer/exoplayer-git'
   ```
4. In a shell:
   ```bash
   $ cd ~/AndroidStudioProjects/exoplayer-test/app
   $ ../gradlew build
   ```

(Step 4 is important, it seems running `./gradlew` from the project root
doesn't trigger the relative path problem)

This change fixes the problem, and also works with `exoplayerRoot` as a
`File` or `Path` object. `String`, `File` and `Path` all work with relative or
absolute paths:
```
gradle.ext.exoplayerRoot = '/home/ibaker/ExoPlayer/exoplayer-git'
gradle.ext.exoplayerRoot = '../../ExoPlayer/exoplayer-git'
gradle.ext.exoplayerRoot = new File('/home/ibaker/ExoPlayer/exoplayer-git')
gradle.ext.exoplayerRoot = new File('../../ExoPlayer/exoplayer-git')
gradle.ext.exoplayerRoot = Paths.get('/home/ibaker/ExoPlayer/exoplayer-git')
gradle.ext.exoplayerRoot = Paths.get('../../ExoPlayer/exoplayer-git')
```

Note: The Path versions above require importing `java.nio.file.Paths`
and changing the `apply from:` line in the project's settings.gradle
file to something like:
```
apply from: file(gradle.ext.exoplayerRoot.resolve('core_settings.gradle'))
```
It's assumed that a project wanting to pass a `Path` will make these
changes.

Issue: #8927
PiperOrigin-RevId: 374421627
2021-05-19 20:23:13 +01:00
aquilescanta
227795964b Add an IntDef for DATA_TYPE_* constants
PiperOrigin-RevId: 374418502
2021-05-19 20:22:48 +01:00
aquilescanta
6c06b4efd1 Re-order error codes for symmetry
PiperOrigin-RevId: 374416794
2021-05-19 20:22:23 +01:00
aquilescanta
61c92007b7 Bubble up the errorCode argument in preparation for new factory methods
Notes:
- The only functional change is that createForRemote now assings ERROR_CODE_REMOTE_ERROR.
- createForSource still uses ERROR_CODE_UNSPECIFIED, even though it expects an
  IOException. The reason for not using ERROR_CODE_IO_UNSPECIFIED is that the reason for
  the error might not be IO. For example, malformed media, or BehindLiveWindowException,
  which have non-IO error codes. So using UNSPECIFIED saves a later change in category.
PiperOrigin-RevId: 374390407
2021-05-19 20:21:57 +01:00
tonihei
378b3f6eb5 Add Util class for server-side inserted ads.
When working with SSAI ads, we need to easily convert positions between
the underlying stream and the media model that exposes ad groups. To
simplify this, we can add util methods (that are testable on their own).

In addition, we need an easy way to build AdPlaybackStates for SSAI
inserted ads. The metadata is obtained out-of-band and usually has the
ad group start and end times in the underlying stream only. Hence, we
also add a util method to add a new ad group based on this information.

PiperOrigin-RevId: 374369360
2021-05-19 20:21:32 +01:00
aquilescanta
c7db9fb390 Deduplicate calls to maybeNotifyPlaybackInfoChanged
PiperOrigin-RevId: 374253036
2021-05-19 20:21:08 +01:00
samrobinson
25b453a5fe Add track number & total to MediaMetadata
#minor-release

PiperOrigin-RevId: 374235979
2021-05-19 20:20:43 +01:00
tonihei
6fd20ddace Fix start position for non-precise startOffset and user-set liveOffset
Also added test cases covering this.

PiperOrigin-RevId: 374218514
2021-05-17 18:20:54 +01:00
olly
c80355c903 Update links for new Javadoc
PiperOrigin-RevId: 374216724
2021-05-17 18:20:33 +01:00
tonihei
04d6c8ed19 Fix grammar nit
PiperOrigin-RevId: 374186953
2021-05-17 18:20:14 +01:00
krocard
6a30af567f Add Commands.Builder.addAllCommands for easy init
MediaSession default command state contains all
commands.
To avoid having to update MediaSession when a command
is added, allow to create a Commands.Builder that
starts with all commands.

PiperOrigin-RevId: 374183484
2021-05-17 18:19:53 +01:00
aquilescanta
17209ed1ee Use the term equivalent instead of equal in assertion
The assertion doesn't check equality (as in x.equals(y)), but rather
whether a subset of the fields are equal.

PiperOrigin-RevId: 374183338
2021-05-17 18:19:32 +01:00
olly
2566b24642 Remove deprecated Listener.onTimelineChanged
PiperOrigin-RevId: 374171038
2021-05-17 18:19:13 +01:00
olly
0c80a54bc1 Update avcLevelToMaxFrameSize for AVCLevel6, 61 and 62
#minor-release

PiperOrigin-RevId: 374161340
2021-05-17 18:18:34 +01:00
christosts
1dfda7ab6e ForwardingPlayer implements Player
Make ForwardingPlayer implement Player and not extend BasePlayer so that
ForwardingPlayer forwards each Player method directly to the wrapped
Player instance.

PiperOrigin-RevId: 374161084
2021-05-17 18:18:14 +01:00
ibaker
ea597a8002 Remove reference to Issue #4133 in exoplayer.dev/drm
The issue is fixed in 2.14.0 - keys are fetched ahead of playback

#minor-release

PiperOrigin-RevId: 374159998
2021-05-17 18:17:54 +01:00
Oliver Woodman
a79b61f86b Merge branch 'release-v2' into dev-v2 2021-05-14 11:52:11 +01:00
Oliver Woodman
92e05bcd66 Remove dev release notes from release 2021-05-14 11:36:34 +01:00
Oliver Woodman
bd54394391
Merge pull request #8939 from google/dev-v2-r2.14.0
r2.14.0
2021-05-14 11:32:30 +01:00
ibaker
637c58d9de Clarify the exoplayerRoot path must be absolute in README.md#locally
Issue: #8927

#minor-release

PiperOrigin-RevId: 373752448
2021-05-14 11:28:22 +01:00
Oliver Woodman
75c8506a81 Remove VCT directories for now 2021-05-14 11:27:59 +01:00
ibaker
36533dcbaf Clarify the exoplayerRoot path must be absolute in README.md#locally
Issue: #8927

#minor-release

PiperOrigin-RevId: 373752448
2021-05-14 11:25:07 +01:00
tonihei
795210d7bc Update player logic to handle server-side inserted ads.
There are two main changes that need to be made:
 1. Whenever we determine the next ad to play, we need to select a
    server-side inserted ad even if it has been played already (because
    it's part of the stream).
 2. When the Timeline is updated in the player, we need to avoid changes
    that would unnecessarily reset the renderers. Whenever a Timeline
    change replaces content with a server-side inserted ad at the same
    position we can just keep the existing MediaPeriod and also if the
    duration of the current MediaPeriod is reduced but it is followed by
    a MediaPeriod in the same SSAI stream, we can don't need to reset
    the renderers as we keep playing the same stream.

PiperOrigin-RevId: 373745031
2021-05-14 11:24:46 +01:00
gyumin
bd4ba4c583 Unnest session vct directories
Tested:
  $ ./gradlew :media-test-session-current:cAT
  $ blaze test test_session_current/src/androidTest:test_with_current_support_app
  The tests run but seem flaky, not related to this change.
PiperOrigin-RevId: 373677924
2021-05-14 11:24:23 +01:00
olly
0318023bf1 Include MediaSource deps in all demo apps
This is mainly so that developers can try out RTSP with
the main demo app without having to change the build.gradle
file.

The change also aligns what media can be played across the
different demo apps.

#minor-release

PiperOrigin-RevId: 373591974
2021-05-13 17:30:29 +01:00
olly
6d3e9fc251 Include MediaSource deps in all demo apps
This is mainly so that developers can try out RTSP with
the main demo app without having to change the build.gradle
file.

The change also aligns what media can be played across the
different demo apps.

#minor-release

PiperOrigin-RevId: 373591974
2021-05-13 17:26:08 +01:00
olly
cc77298dfc Correctly remove package-info.java from empty packages
#minor-release

PiperOrigin-RevId: 373550935
2021-05-13 12:10:50 +01:00
olly
c71fa05c88 Correctly remove package-info.java from empty packages
#minor-release

PiperOrigin-RevId: 373550935
2021-05-13 12:09:17 +01:00
olly
34428b699a Minor translation updates
#minor-release

PiperOrigin-RevId: 373543587
2021-05-13 11:08:06 +01:00
olly
cc05e85700 Minor translation updates
#minor-release

PiperOrigin-RevId: 373543587
2021-05-13 11:05:15 +01:00
aquilescanta
a8675673da Add backward compatibility tests for PlaybackException
PiperOrigin-RevId: 373542819
2021-05-13 10:52:59 +01:00
tonihei
954a6730d5 Allow ad groups to be marked as server-side inserted.
This helps both player the logic and clients like UI or analytics to
detect SSAI ads.

PiperOrigin-RevId: 373540754
2021-05-13 10:52:37 +01:00
klhyun
bec7b0041e Make Cue implement Bundleable
In order to deliver Cue objects between different processes
(e.g. in Player#getCurrentCues), this CL makes it Bundleable.

PiperOrigin-RevId: 373524501
2021-05-13 10:52:12 +01:00
olly
5ff2d24fab Update PlayerNotficationManager to set PendingIntent.FLAG_IMMUTABLE on its Broadcast intent.
In Android 12 mutability flags have to be set on PendingIntents. If they are not, and the app targets Android 12, then the app will be crashed by the system.

PiperOrigin-RevId: 373427591
2021-05-13 10:51:48 +01:00
olly
6596cd1d83 Remove legacyKeepAvailableCodecInfosWithoutCodec
It's no longer used.

PiperOrigin-RevId: 373426109
2021-05-13 10:51:26 +01:00
samrobinson
46c5f030ce Add an artwork field to MediaMetadata
#minor-release

PiperOrigin-RevId: 373410795
2021-05-13 10:51:02 +01:00
olly
d38edcc949 Minor copy edits for RTSP docs
#minor-release

PiperOrigin-RevId: 373402932
2021-05-12 18:59:19 +01:00
olly
cccb40065c Minor copy edits for RTSP docs
#minor-release

PiperOrigin-RevId: 373402932
2021-05-12 18:58:13 +01:00
tonihei
ef5a0b6c4d Allow ad groups to specify a resume offset.
Content after ad groups currently always resumes at the ad break position (unless
overridden by a seek or similar).  In some cases, media inserting ads wants to
specify an offset after the ad group at which playback should resume. A common
example is a live stream that inserts an ad and then wants to continue streaming
at the current live edge.

Support this use case by allowing ad groups to specify a content resume offset
and making sure that the content start position after the ad group uses this offset.

PiperOrigin-RevId: 373393807
2021-05-12 18:57:45 +01:00
olly
a038f875f6 Update Javadoc for 2.14.0
#minor-release

PiperOrigin-RevId: 373351935
2021-05-12 13:55:32 +01:00
olly
d53d2ca07d Fix search links in generated Javadoc
#minor-release

PiperOrigin-RevId: 373351014
2021-05-12 13:55:08 +01:00
Oliver Woodman
e20ea797ef Merge pull request #8767 from uvjustin:hls-start-from-independent-part
PiperOrigin-RevId: 373343326
2021-05-12 13:54:44 +01:00
claincly
d608254ab0 Remove RTSP message logging.
#minor-release

PiperOrigin-RevId: 373336127
2021-05-12 13:02:54 +01:00
claincly
77008e16fe Allow RTSP streaming using TCP.
NAT will block off incoming UDP connection because the router has no knowledge
of the necessary port mapping (the mapping is never set up because UDP is
connectionless).

The end result is, the UDP socket to receive RTP data will timeout. After the
`SocketTimeoutException` is caught, the following takes place to try streaming
with TCP (or, RTP over RTSP).

- `RtspClient` sends TEARDOWN to tear down the current session.
- `RtspClient` re-connect to the RTSP server.
- `RtspMediaPeriod` cancels all loading `RtpDataLoadables` (that are using UDP)
- `RtspMediaPeriod` constructs new `RtpDataLoadables` that use
    `TransferRtpDataChannel`, and starts loading.
- Once the `RtpDataLoadables` are up and running, we are ready to receive.
  `RtspClient` sends the SETUP requests.

- The rest of the flow is unchanged.

#minor-release

PiperOrigin-RevId: 373310774
2021-05-12 13:02:48 +01:00
claincly
2fc7b9c79b Move misplaced RTSP doc.
#minor-release

PiperOrigin-RevId: 373175041
2021-05-12 13:02:36 +01:00
claincly
373855b30c Add dev guide for RTSP.
#minor-release

PiperOrigin-RevId: 373173075
2021-05-12 13:02:30 +01:00