Remove usage of mutable static BundledChunkExtractor.FACTORY

PiperOrigin-RevId: 715328246
This commit is contained in:
ibaker 2025-01-14 04:39:07 -08:00 committed by Copybara-Service
parent 1892435fb3
commit 6300a55eb2
3 changed files with 12 additions and 9 deletions

View File

@ -194,8 +194,11 @@ public final class BundledChunkExtractor implements ExtractorOutput, ChunkExtrac
} }
} }
/** {@link Factory} for {@link BundledChunkExtractor}. */ /**
public static final Factory FACTORY = new Factory(); * @deprecated {@link Factory} is mutable, so a static instance is not safe. Instantiate a new
* {@link Factory} instead.
*/
@Deprecated public static final Factory FACTORY = new Factory();
private static final PositionHolder POSITION_HOLDER = new PositionHolder(); private static final PositionHolder POSITION_HOLDER = new PositionHolder();

View File

@ -91,10 +91,10 @@ public class DefaultDashChunkSource implements DashChunkSource {
/** /**
* Equivalent to {@link #Factory(ChunkExtractor.Factory, DataSource.Factory, int) new * Equivalent to {@link #Factory(ChunkExtractor.Factory, DataSource.Factory, int) new
* Factory(BundledChunkExtractor.FACTORY, dataSourceFactory, maxSegmentsPerLoad)}. * Factory(new BundledChunkExtractor.Factory(), dataSourceFactory, maxSegmentsPerLoad)}.
*/ */
public Factory(DataSource.Factory dataSourceFactory, int maxSegmentsPerLoad) { public Factory(DataSource.Factory dataSourceFactory, int maxSegmentsPerLoad) {
this(BundledChunkExtractor.FACTORY, dataSourceFactory, maxSegmentsPerLoad); this(new BundledChunkExtractor.Factory(), dataSourceFactory, maxSegmentsPerLoad);
} }
/** /**

View File

@ -87,7 +87,7 @@ public class DefaultDashChunkSourceTest {
SAMPLE_MPD_LIVE_WITH_OFFSET_INSIDE_WINDOW)); SAMPLE_MPD_LIVE_WITH_OFFSET_INSIDE_WINDOW));
DefaultDashChunkSource chunkSource = DefaultDashChunkSource chunkSource =
new DefaultDashChunkSource( new DefaultDashChunkSource(
BundledChunkExtractor.FACTORY, new BundledChunkExtractor.Factory(),
new LoaderErrorThrower.Placeholder(), new LoaderErrorThrower.Placeholder(),
manifest, manifest,
new BaseUrlExclusionList(), new BaseUrlExclusionList(),
@ -139,7 +139,7 @@ public class DefaultDashChunkSourceTest {
ApplicationProvider.getApplicationContext(), SAMPLE_MPD_VOD)); ApplicationProvider.getApplicationContext(), SAMPLE_MPD_VOD));
DefaultDashChunkSource chunkSource = DefaultDashChunkSource chunkSource =
new DefaultDashChunkSource( new DefaultDashChunkSource(
BundledChunkExtractor.FACTORY, new BundledChunkExtractor.Factory(),
new LoaderErrorThrower.Placeholder(), new LoaderErrorThrower.Placeholder(),
manifest, manifest,
new BaseUrlExclusionList(), new BaseUrlExclusionList(),
@ -551,7 +551,7 @@ public class DefaultDashChunkSourceTest {
"media/mpd/sample_mpd_live_known_duration_not_ended")); "media/mpd/sample_mpd_live_known_duration_not_ended"));
DefaultDashChunkSource chunkSource = DefaultDashChunkSource chunkSource =
new DefaultDashChunkSource( new DefaultDashChunkSource(
BundledChunkExtractor.FACTORY, new BundledChunkExtractor.Factory(),
new LoaderErrorThrower.Placeholder(), new LoaderErrorThrower.Placeholder(),
manifest, manifest,
new BaseUrlExclusionList(), new BaseUrlExclusionList(),
@ -600,7 +600,7 @@ public class DefaultDashChunkSourceTest {
"media/mpd/sample_mpd_live_known_duration_ended")); "media/mpd/sample_mpd_live_known_duration_ended"));
DefaultDashChunkSource chunkSource = DefaultDashChunkSource chunkSource =
new DefaultDashChunkSource( new DefaultDashChunkSource(
BundledChunkExtractor.FACTORY, new BundledChunkExtractor.Factory(),
new LoaderErrorThrower.Placeholder(), new LoaderErrorThrower.Placeholder(),
manifest, manifest,
new BaseUrlExclusionList(), new BaseUrlExclusionList(),
@ -665,7 +665,7 @@ public class DefaultDashChunkSourceTest {
selectedTracks, selectedTracks,
new DefaultBandwidthMeter.Builder(ApplicationProvider.getApplicationContext()).build()); new DefaultBandwidthMeter.Builder(ApplicationProvider.getApplicationContext()).build());
return new DefaultDashChunkSource( return new DefaultDashChunkSource(
BundledChunkExtractor.FACTORY, new BundledChunkExtractor.Factory(),
new LoaderErrorThrower.Placeholder(), new LoaderErrorThrower.Placeholder(),
manifest, manifest,
new BaseUrlExclusionList(new Random(/* seed= */ 1234)), new BaseUrlExclusionList(new Random(/* seed= */ 1234)),