mirror of
https://github.com/androidx/media.git
synced 2025-05-10 00:59:51 +08:00
Add common prefix to loader thread names
All threads created by ExoPlayer should now have the prefix "ExoPlayer:". PiperOrigin-RevId: 356518037
This commit is contained in:
parent
50db2ee172
commit
e28332ff82
@ -538,7 +538,7 @@ public final class Util {
|
|||||||
* @param threadName The name of the thread.
|
* @param threadName The name of the thread.
|
||||||
* @return The executor.
|
* @return The executor.
|
||||||
*/
|
*/
|
||||||
public static ExecutorService newSingleThreadExecutor(final String threadName) {
|
public static ExecutorService newSingleThreadExecutor(String threadName) {
|
||||||
return Executors.newSingleThreadExecutor(runnable -> new Thread(runnable, threadName));
|
return Executors.newSingleThreadExecutor(runnable -> new Thread(runnable, threadName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
this.allocator = allocator;
|
this.allocator = allocator;
|
||||||
this.customCacheKey = customCacheKey;
|
this.customCacheKey = customCacheKey;
|
||||||
this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes;
|
this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes;
|
||||||
loader = new Loader("Loader:ProgressiveMediaPeriod");
|
loader = new Loader("ProgressiveMediaPeriod");
|
||||||
this.progressiveMediaExtractor = new BundledExtractorsAdapter(extractorsFactory);
|
this.progressiveMediaExtractor = new BundledExtractorsAdapter(extractorsFactory);
|
||||||
loadCondition = new ConditionVariable();
|
loadCondition = new ConditionVariable();
|
||||||
maybeFinishPrepareRunnable = this::maybeFinishPrepare;
|
maybeFinishPrepareRunnable = this::maybeFinishPrepare;
|
||||||
|
@ -88,7 +88,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
|||||||
this.treatLoadErrorsAsEndOfStream = treatLoadErrorsAsEndOfStream;
|
this.treatLoadErrorsAsEndOfStream = treatLoadErrorsAsEndOfStream;
|
||||||
tracks = new TrackGroupArray(new TrackGroup(format));
|
tracks = new TrackGroupArray(new TrackGroup(format));
|
||||||
sampleStreams = new ArrayList<>();
|
sampleStreams = new ArrayList<>();
|
||||||
loader = new Loader("Loader:SingleSampleMediaPeriod");
|
loader = new Loader("SingleSampleMediaPeriod");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void release() {
|
public void release() {
|
||||||
|
@ -133,7 +133,7 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
|
|||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.mediaSourceEventDispatcher = mediaSourceEventDispatcher;
|
this.mediaSourceEventDispatcher = mediaSourceEventDispatcher;
|
||||||
this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
|
this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
|
||||||
loader = new Loader("Loader:ChunkSampleStream");
|
loader = new Loader("ChunkSampleStream");
|
||||||
nextChunkHolder = new ChunkHolder();
|
nextChunkHolder = new ChunkHolder();
|
||||||
mediaChunks = new ArrayList<>();
|
mediaChunks = new ArrayList<>();
|
||||||
readOnlyMediaChunks = Collections.unmodifiableList(mediaChunks);
|
readOnlyMediaChunks = Collections.unmodifiableList(mediaChunks);
|
||||||
|
@ -152,6 +152,8 @@ public final class Loader implements LoaderErrorThrower {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String THREAD_NAME_PREFIX = "ExoPlayer:Loader:";
|
||||||
|
|
||||||
/** Types of action that can be taken in response to a load error. */
|
/** Types of action that can be taken in response to a load error. */
|
||||||
@Documented
|
@Documented
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@ -210,10 +212,12 @@ public final class Loader implements LoaderErrorThrower {
|
|||||||
@Nullable private IOException fatalError;
|
@Nullable private IOException fatalError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param threadName A name for the loader's thread.
|
* @param threadNameSuffix A name suffix for the loader's thread. This should be the name of the
|
||||||
|
* component using the loader.
|
||||||
*/
|
*/
|
||||||
public Loader(String threadName) {
|
public Loader(String threadNameSuffix) {
|
||||||
this.downloadExecutorService = Util.newSingleThreadExecutor(threadName);
|
this.downloadExecutorService =
|
||||||
|
Util.newSingleThreadExecutor(THREAD_NAME_PREFIX + threadNameSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7392,7 +7392,7 @@ public final class ExoPlayerTest {
|
|||||||
drmSessionManager,
|
drmSessionManager,
|
||||||
drmEventDispatcher,
|
drmEventDispatcher,
|
||||||
/* deferOnPrepared= */ false) {
|
/* deferOnPrepared= */ false) {
|
||||||
private Loader loader = new Loader("oomLoader");
|
private final Loader loader = new Loader("ExoPlayerTest");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean continueLoading(long positionUs) {
|
public boolean continueLoading(long positionUs) {
|
||||||
|
@ -562,7 +562,7 @@ public final class DashMediaSource extends BaseMediaSource {
|
|||||||
processManifest(false);
|
processManifest(false);
|
||||||
} else {
|
} else {
|
||||||
dataSource = manifestDataSourceFactory.createDataSource();
|
dataSource = manifestDataSourceFactory.createDataSource();
|
||||||
loader = new Loader("Loader:DashMediaSource");
|
loader = new Loader("DashMediaSource");
|
||||||
handler = Util.createHandlerForCurrentLooper();
|
handler = Util.createHandlerForCurrentLooper();
|
||||||
startLoadingManifest();
|
startLoadingManifest();
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ public final class SsMediaSource extends BaseMediaSource
|
|||||||
processManifest();
|
processManifest();
|
||||||
} else {
|
} else {
|
||||||
manifestDataSource = manifestDataSourceFactory.createDataSource();
|
manifestDataSource = manifestDataSourceFactory.createDataSource();
|
||||||
manifestLoader = new Loader("Loader:Manifest");
|
manifestLoader = new Loader("SsMediaSource");
|
||||||
manifestLoaderErrorThrower = manifestLoader;
|
manifestLoaderErrorThrower = manifestLoader;
|
||||||
manifestRefreshHandler = Util.createHandlerForCurrentLooper();
|
manifestRefreshHandler = Util.createHandlerForCurrentLooper();
|
||||||
startLoadingManifest();
|
startLoadingManifest();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user