media/libraries
ibaker d0b757886e Fix handling of length-delimited NAL units with 1 or 2 byte length
ExoPlayer assumed 4-bytes for length in two places (by assuming the
length is the same as the 4-byte NAL start code):

1. In `AvcConfig` we transform length-delimited to start-delimited
   before writing into `initializationData`, and then skip
   'nal unit length field' bytes when parsing from `initializationData`
   (when we should skip 'start code length' bytes instead).

2. In `Mp4Extractor.readSample` we modify the local variable
   `sampleSize` to fix the difference between length field length and
   start code length, but **only on the first attempt to read a
   sample**. If we are resuming in the middle of reading a sample (after
   a recoverable I/O error), this fix for `sampleSize` is not done,
   which means we end up missing the last 2-3 bytes of the sample when
   the NAL length is 1-2 bytes.
     * This is fixed by moving the `sampleSize` 'fixing' code to outside
       the `if (sampleCurrentNalBytesRemaining == 0)` block.
     * `FragmentedMp4Extractor` has very similar code, but uses a
       field for `sampleSize`, rather than a local, so doesn't look
       vulnerable to the same problem (though I haven't totally
       tested this).

This change adds a test file with 2-byte NAL lengths, generated by
hacking the media3 muxer to emit 2-byte NAL lengths and transforming
`sample.mp4` using the transformer demo app.

PiperOrigin-RevId: 713709203
2025-01-09 10:06:13 -08:00
..
cast Remove @DoNotInline annotations 2024-09-18 04:47:39 -07:00
common Use live providers in CompositionPlayer to remove workaround 2025-01-09 07:10:14 -08:00
common_ktx Add jvmTarget and kotlin-android plugin to common_ktx module 2024-08-15 10:36:10 -07:00
container Add a test file for FragmentedMp4 captions 2025-01-09 07:35:21 -08:00
database Enable lint errors in database tests 2024-12-04 03:55:33 -08:00
datasource Enable lint errors in datasource tests 2024-12-03 10:07:19 -08:00
datasource_cronet DataSourceContractTest: Tighten assertions around 'not found' URIs 2024-10-24 03:49:27 -07:00
datasource_okhttp DataSourceContractTest: Tighten assertions around 'not found' URIs 2024-10-24 03:49:27 -07:00
datasource_rtmp Remove exoplayer2-only javadoc machinery from media3 2023-06-05 09:47:58 +00:00
decoder MediaCodecVideoRenderer skips decoder inputs unused as reference 2024-07-09 03:43:06 -07:00
decoder_av1 Add missing DefaultRenderersFactoryTest for decoder extensions 2024-10-30 05:33:38 -07:00
decoder_ffmpeg Add 16 KB page support for decoder extensions on Android 15 2024-10-10 10:18:20 -07:00
decoder_flac Set container MIME type for audio-only extractors 2024-11-14 10:03:17 -08:00
decoder_iamf Enable lint errors in tests for remaining playback modules 2024-12-04 08:08:01 -08:00
decoder_midi Use ForwardingTrackOutput in MidiExtractor 2024-12-03 07:14:58 -08:00
decoder_mpegh Merge Issue: androidx/media#1826: add extension for MPEG-H decoding 2024-10-24 09:53:45 -07:00
decoder_opus Removed empty line 2024-12-11 14:47:04 +00:00
decoder_vp9 Add 16 KB page support for decoder extensions on Android 15 2024-10-10 10:18:20 -07:00
effect Make auto frame registration test non-flaky 2025-01-09 04:21:39 -08:00
exoplayer Don't force discontinuity when clipping a merged source duration 2025-01-09 08:47:33 -08:00
exoplayer_dash Discard already written sample data for clipped DASH periods 2025-01-08 07:47:54 -08:00
exoplayer_hls Merge pull request #1785 from DolbyLaboratories:dlb/dovi-supplemental-codecs/dev 2025-01-07 04:58:21 -08:00
exoplayer_ima Add client side post roll placeholder 2024-12-17 09:59:16 -08:00
exoplayer_rtsp Enable lint errors in tests for remaining playback modules 2024-12-04 08:08:01 -08:00
exoplayer_smoothstreaming Refactor CmcdData to handle object type determination internally 2024-12-12 04:36:16 -08:00
exoplayer_workmanager Remove exoplayer2-only javadoc machinery from media3 2023-06-05 09:47:58 +00:00
extractor Fix handling of length-delimited NAL units with 1 or 2 byte length 2025-01-09 10:06:13 -08:00
muxer Remove TrackToken and replace with int trackId 2025-01-07 10:16:31 -08:00
session Do not override pending info when masking 2025-01-07 08:26:19 -08:00
test_data Fix handling of length-delimited NAL units with 1 or 2 byte length 2025-01-09 10:06:13 -08:00
test_exoplayer_playback Enable lint errors in tests for remaining playback modules 2024-12-04 08:08:01 -08:00
test_session_common Add media button preferences 2024-10-17 09:54:36 -07:00
test_session_current Do not override pending info when masking 2025-01-07 08:26:19 -08:00
test_utils Implement transfer of resources API for renderer pre-warming 2025-01-08 12:12:48 -08:00
test_utils_robolectric Add TestPlayerRunHelper run(player).untilFullyBuffered 2024-11-06 02:45:51 -08:00
transformer Add mediaItem durationUs to Transformer's ExportResult.ProcessedInput 2025-01-09 08:51:00 -08:00
ui Change lib-common dependency scope to api in lib-ui 2024-11-06 08:21:16 -08:00
ui_compose [ui-compose] Fix PlayerSurface's use of Player 2025-01-08 06:07:14 -08:00
ui_leanback Bump effect and leanback minSdk to 19 2024-01-10 07:22:00 -08:00
lint.xml Enable lint in lib-common tests 2024-11-04 04:16:39 -08:00