3309 Commits

Author SHA1 Message Date
Alexey Rochev
adee4626d3 ffmpeg: reallocate output buffer dynamically
With FFmpeg we can't determine size of output buffer ahead of time for all codecs,
so we need to reallocate it when needed instead of simply failing.
2023-10-31 12:25:32 +00:00
ibaker
3a527a888a Split openAssetFileDescriptor from RawResourceDataSource.open
This moves the invocation of `transferInitializing` slightly earlier,
but this is consistent with other `DataSource` implementations like
`OkHttpDataSource`.

PiperOrigin-RevId: 578137236
2023-10-31 04:38:57 -07:00
ibaker
88f554c74b Add cross-package support to RawResourceDataSource
This has been documented to work since this class was created, but until
now we were always trying to resolve using the current application's
`Resources.getIdentifier` method. This commit changes to resolve to the
other app's `Resources` object if the package name doesn't match the
current package.

This will only work if the current app has package-visibility to the
destination package: http://g.co/dev/packagevisibility

This is hard to test because to do so robustly requires being able to
guaranteed that another test APK will be installed with a known raw
resource inside it.

PiperOrigin-RevId: 577864992
2023-10-30 09:17:45 -07:00
ibaker
26789b56c2 Remove unecessary proguard config symlink
PiperOrigin-RevId: 577858121
2023-10-30 08:53:51 -07:00
ibaker
841cdf170b Reduce HlsMediaPeriod to package-private visibility
This type shouldn't be directly depended on from outside the HLS
package.

PiperOrigin-RevId: 577833188
2023-10-30 07:17:52 -07:00
ibaker
e30e43ec3f Migrate EventLogger to non-deprecated AnalyticsListener methods
Also suppress a warning about unused constructor parameters.

#minor-release

PiperOrigin-RevId: 577795245
2023-10-30 04:05:46 -07:00
jbibik
1ac6263869 Test DASH playback + standalone WebVTT parsed during extraction
This change applies to standalone WebVTT files linked directly from the manifest.

Since DASH only supports stand-alone IMSC1 (TTML) and WebVTT text files, this change concludes the support extension of text-based subtitle files to be parse during extraction.

PiperOrigin-RevId: 577468830
2023-10-28 08:44:11 -07:00
jbibik
97efa70852 Add DASH support for parsing standalone TTML files during extraction
This change applies to standalone TTML files linked directly from the manifest.

As a result, we no longer have the flakiness in the DashPlaybackTest which uses sidecar-loaded (standalone file) TTML subtitles. We experimentally opt into parsing subtitles during extraction and use SubtitleExtractor in hybrid mode.

PiperOrigin-RevId: 577457256
2023-10-28 06:59:45 -07:00
jbibik
1359b0147d Add an HLS End-to-End test with WebVtt sidecar subtitles
These subtitles are parsed using the old-flow, i.e. after decoding.

PiperOrigin-RevId: 577452579
2023-10-28 06:15:24 -07:00
sheenachhabra
5b0be4e8b0 Create unique name for export output file.
With pause/resume functionality coming in, we need the output file
path to be different from the previous one.

PiperOrigin-RevId: 577175540
2023-10-27 06:12:23 -07:00
huangdarwin
fed88cf6f5 Flush: Disallow flushing when there's no active input.
Throws when calling flush when there's no active input, for example
before an input stream is registered or after all output streams have
ended.

PiperOrigin-RevId: 577165419
2023-10-27 05:23:38 -07:00
huangdarwin
346b9257ba Flush: VideoFrameProcessor texture output
PiperOrigin-RevId: 576928149
2023-10-26 11:06:04 -07:00
claincly
841b4fba9a Fix GL releasing surface that doesn't need releasing
PiperOrigin-RevId: 576545767
2023-10-25 09:05:11 -07:00
sheenachhabra
1e2815cade Simplify Mp4ExtractorWrapper implementation
Changes includes:
1. Create static factory method and hide constructor.
2. Move all the fetching logic to init() method.

PiperOrigin-RevId: 576544902
2023-10-25 09:02:02 -07:00
claincly
3204da41fe Add performance test for composition previewing
PiperOrigin-RevId: 576509031
2023-10-25 06:22:16 -07:00
huangdarwin
e91ce868ad Flush: Add javadoc to mention flush limitation.
PiperOrigin-RevId: 576482193
2023-10-25 04:10:32 -07:00
sheenachhabra
fe6305931d Add moto g(20) API 30 in the allowed frame dropping list
This is a workaround to avoid frame dropping.

PiperOrigin-RevId: 576467065
2023-10-25 03:07:08 -07:00
Googler
8796b2e21e Add isPrioritizeImageOverVideoEnabled to TrackSelectionParameters
This CL adds an isPrioritizeImageOverVideoEnabled flag to
TrackSelectionParameters and an API to set the flag value.

The flag will be used by DefaultTrackSelector to determine whether
to select an image track if both an image track and a video track are available.

PiperOrigin-RevId: 576175162
2023-10-24 10:01:22 -07:00
tofunmi
beed1bd76e Pass initial timestamp offset to EncodedSampleExporter
When transmuxing, we usually only need to offset the timestamp by the position of a mediaItem in a sequence.

Trim optimization introduces another type of offset: for the transmux of the second part of the video we need to offset the timestamps by the total duration already trancoded by transformer.

PiperOrigin-RevId: 576134656
2023-10-24 07:39:23 -07:00
huangdarwin
a8a590c305 Effect: Clarify flush behavior in javadoc
PiperOrigin-RevId: 576118064
2023-10-24 06:13:22 -07:00
claincly
1fc34676d9 Make sure effects are applied on the correct frame
The events happens in the following order, assuming two media items:

1. First media item is fully decoded, record the last frame's pts
  - Note frame processing is still ongoing for this media item
2. Renderer sends `onOutputFormatChanged()` to signal the second media item
3. **Block sending the frames of the second media item to the `VideoSink`**
4. Frame processing finishes on the first media item
5. The last frame of the first media item is released
6. **Reconfigure the `VideoSink` to apply new effects**
7. **Start sending the frames of the second media item to the `VideoSink`**

This CL implements the **events in bold**

PiperOrigin-RevId: 576098798
2023-10-24 04:45:05 -07:00
claincly
e8adbd9075 Require duration in EditedMediaItem in composition previewing
Adds an additional field for actual presentation duration of the
EditedMediaItem

PiperOrigin-RevId: 576090574
2023-10-24 04:09:14 -07:00
tofunmi
771d203204 ExoAssetLoaderRenderer:Drop negative timestamp buffers when transmuxing
Prevents queuing unneeded buffers when transmuxing. (we already do this when transcoding).

PiperOrigin-RevId: 576080462
2023-10-24 03:21:56 -07:00
Copybara-Service
64d93eb0d1 Merge pull request #710 from loki666:patch-2
PiperOrigin-RevId: 575817952
2023-10-23 07:58:17 -07:00
christosts
71602767ca Restructure TrackEvent.populateFrom() 2023-10-23 14:44:27 +00:00
Philippe Simons
a06430a513 Update TrackEvent.java 2023-10-23 14:32:03 +00:00
Philippe Simons
b27b65199a Update TrackEvent.java 2023-10-23 14:32:03 +00:00
Philippe Simons
fc2099dede MIDI: Ignore SysEx messages
ignore SysEx messages instead of choking
2023-10-23 14:32:03 +00:00
simakova
1ba1998e8d Update param description in TimestampWrapper
PiperOrigin-RevId: 575806256
2023-10-23 07:02:09 -07:00
rohks
9d3d7abdc6 Bump Media3 version numbers for 1.2.0-rc01
#minor-release

PiperOrigin-RevId: 575805495
2023-10-23 06:57:55 -07:00
michaelkatz
4515a0c3f2 Fallback to legacy sizerate check for H264 if CDD PerfPoint check fails
Some devices supporting Performance Points for decoder coverage are missing coverage over the CDD requirements for H264. For these cases ExoPlayer should fall back to legacy resolution and frame rate support checks. If there is an H264 stream evaluated as a `PerformancePointCoverageResult` of `COVERAGE_RESULT_NO`, then ExoPlayer checks for coverage of the [720p CDD requirement](https://source.android.com/docs/compatibility/10/android-10-cdd#5_3_4_h_264).

Issue: google/ExoPlayer#10898

Issue: androidx/media#693
PiperOrigin-RevId: 575768836
2023-10-23 03:49:50 -07:00
bachinger
a79d44edc5 Use MediaSessionImpl.onMediaButtonEvent() to dispatch key events
This change moves the handling of any media button event into
`MediaSessionImpl.onMediaButtonEvent(intent)`. This includes
the double click handling from `MediaSessionLegacyStub`.

The advantage is that everything is in one place which allows
to offer `MediaSession.Callback.onMediaButtonEvent` with which
an app can override the default implementation and handle media
buttons in a custom way.

Media button events can originate from various places:

- Delivered to `MediaSessionService.onStartCommand(Intent)`
  - A `PendingIntent` from the notification below API 33
  - An `Intent` sent to the `MediaButtonReceiver` by the system dispatched
    to the service
- Delivered to `MediaSessionCompat.Callback.onMediaButtonEvent(Intent)`
  implemented by `MediaSessionLegacyStub` during the session is active
  - Bluetooth (headset/remote control)
  - Apps/system using `AudioManager.dispatchKeyEvent(KeyEvent)`
  - Apps/system using `MediaControllerCompat.dispatchKeyEvent(keyEvent)`

Issue: androidx/media#12
Issue: androidx/media#159
Issue: androidx/media#216
Issue: androidx/media#249

#minor-release

PiperOrigin-RevId: 575231251
2023-10-20 08:55:15 -07:00
rohks
a8ab9e2c70 Update translations in the ui module
#minor-release

PiperOrigin-RevId: 575161190
2023-10-20 02:52:30 -07:00
tonihei
bfd1a2724c Add missing command checks to playback resumption flow
Player methods shouldn't be called if they are not available and the
entry point to the playback resumption flow only checks
COMMAND_PLAY_PAUSE.

#minor-release

PiperOrigin-RevId: 574834148
2023-10-19 05:39:21 -07:00
Copybara-Service
5f80a47081 Merge pull request #728 from lawadr:audio-capabilities-fix
PiperOrigin-RevId: 574829263
2023-10-19 05:18:21 -07:00
claincly
2673b64371 Ignore 8k export test on incapable devices
And add a test to cover 8k transcode to lower resolution

PiperOrigin-RevId: 574809781
2023-10-19 03:58:13 -07:00
bachinger
54d5810fc3 Do not hide System UI when app rejects connection
If an app rejects the connection of the internal media notification manager
the session should behave like without the the media notification controller.
The legacy System UI controller should not be hidden or even rejected to
connect in such a case.

#minor-release

PiperOrigin-RevId: 574807901
2023-10-19 03:51:19 -07:00
lawadr
580ff6759c Fix AudioCapabilities regression
Since DEFAULT_MAX_CHANNEL_COUNT was increased from 8 to 10,
getMaxSupportedChannelCountForPassthrough always throws if its loop
enters its second iteration (channelCount of 9). This is due to
Util.getAudioTrackChannelConfig returning CHANNEL_INVALID when passed a
channelCount of 9, and setting CHANNEL_INVALID as the AudioFormat's
channel mask throws an exception.

This change skips each iteration where CHANNEL_INVALID is returned.
2023-10-19 09:17:41 +01:00
tonihei
f0cab4d03e Rollback of 64bd3bcad3
PiperOrigin-RevId: 574766164
2023-10-19 01:06:08 -07:00
Googler
cf3733765c Rollback of eafe2e35f0
PiperOrigin-RevId: 574755143
2023-10-19 00:21:43 -07:00
okunhardt
fa8dc4f49a Implement HttpEngineDataSource, a HttpDataSource using the [HttpEngine](https://developer.android.com/reference/android/net/http/HttpEngine) API.
HttpEngine was added in Android SDK 34. This DataSource is preferable to the DefaultHttpDataSource if supported as it offers better performance and more modern features.

PiperOrigin-RevId: 574594553
2023-10-18 14:17:56 -07:00
tonihei
c0759a4e62 Rollback of 4ebe630a80
PiperOrigin-RevId: 574530273
2023-10-18 11:05:49 -07:00
ibaker
aec6db77fa Add formatting to scheme list in DefaultDataSource javadoc
The current formatting makes the 'scheme' part of the list blend into
the definition, especially when the definition is multi-line.

https://developer.android.com/reference/androidx/media3/datasource/DefaultDataSource

I considered adding another level of nesting, but I think bold will
help distinguish the structure of the list without adding too much HTML
or visual whitespace.

#minor-release

PiperOrigin-RevId: 574514208
2023-10-18 10:17:58 -07:00
michaelkatz
00193e0304 Send decode-only Opus samples in bypass mode for seekPreRoll skip
As Opus decoders skip some bytes prior to playback during a seek, the renderer for bypass playback should send samples to the decoder even if they would be decode-only.

#minor-release

PiperOrigin-RevId: 574494666
2023-10-18 09:11:27 -07:00
tonihei
db86932781 Use DataSourceBitmapLoader by default
This replaces the SimpleBitmapLoader that can now be deprecated
as it's fully unused and doesn't provide any additional functionality.

#minor-release

PiperOrigin-RevId: 574454636
2023-10-18 06:18:32 -07:00
tianyifeng
43e6882fb4 Add PreloadMediaSource and PreloadMediaPeriod
The `PreloadMediaSource` has below two new public methods that suppose to be called by the app:

* `preload(long)` allows the apps to preload the source at the passed start position before playback. The preload efforts include preparing the source for a `Timeline`, creating and caching a `MediaPeriod`, preparing the period, selecting tracks on the period and continuing loading the data on the period.
* `releasePreloadMediaSource()` allows the apps to release the preloaded progress.

The `PreloadMediaPeriod` is designed to facilitate the `PreloadMediaSource` for the preloading work. It has a new package-private method `selectTracksForPreloading` which will cache the `SampleStream` that corresponds to the track selection made during the preloading, and when the `PreloadMediaPeriod.selectTracks` is called for playback, it will uses the preloaded streams if the new selection is equal to the selection made during the preloading.

Also add a shortform demo module to demo the usage of `PreloadMediaSource` with the short-form content use case.

PiperOrigin-RevId: 574439529
2023-10-18 04:57:06 -07:00
christosts
ff4ff76990 Fix MIDI decoder build.gradle
Issue: androidx/media#734

#minor-release

PiperOrigin-RevId: 574425269
2023-10-18 03:42:47 -07:00
christosts
eafe2e35f0 Move video frame release logic to VideoFrameReleaseControl
This change moves the release timestamp adjustment logic out of
MediaCodecVideoRenderer and into a standalone component, the
VideoFrameReleaseControl. The plan for VideoFrameReleaseControl is to use
it:
- from MediaCodecVideoRenderer, when ExoPlayer plays video in standalone
  mode.
- from the CompositionPlayer's DefaultVideoSink, when CompositionPlayer
  supports multiple sequences.
- (temporarily) from the CompositionPlayer's custom ImageRenderer while
  we are implementing single-sequence preview, which is an intermediate
  milestone for composition preview.
PiperOrigin-RevId: 574420427
2023-10-18 03:17:03 -07:00
Googler
ff330bd8e9 Rollback of 4ebe630a80
PiperOrigin-RevId: 574308136
2023-10-17 17:16:01 -07:00
Googler
1a43aa3602 Rollback of 64bd3bcad3
PiperOrigin-RevId: 574290408
2023-10-17 16:01:10 -07:00