mirror of
https://github.com/androidx/media.git
synced 2025-05-09 16:40:55 +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.
|
||||
* @return The executor.
|
||||
*/
|
||||
public static ExecutorService newSingleThreadExecutor(final String threadName) {
|
||||
public static ExecutorService newSingleThreadExecutor(String threadName) {
|
||||
return Executors.newSingleThreadExecutor(runnable -> new Thread(runnable, threadName));
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
this.allocator = allocator;
|
||||
this.customCacheKey = customCacheKey;
|
||||
this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes;
|
||||
loader = new Loader("Loader:ProgressiveMediaPeriod");
|
||||
loader = new Loader("ProgressiveMediaPeriod");
|
||||
this.progressiveMediaExtractor = new BundledExtractorsAdapter(extractorsFactory);
|
||||
loadCondition = new ConditionVariable();
|
||||
maybeFinishPrepareRunnable = this::maybeFinishPrepare;
|
||||
|
@ -88,7 +88,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
this.treatLoadErrorsAsEndOfStream = treatLoadErrorsAsEndOfStream;
|
||||
tracks = new TrackGroupArray(new TrackGroup(format));
|
||||
sampleStreams = new ArrayList<>();
|
||||
loader = new Loader("Loader:SingleSampleMediaPeriod");
|
||||
loader = new Loader("SingleSampleMediaPeriod");
|
||||
}
|
||||
|
||||
public void release() {
|
||||
|
@ -133,7 +133,7 @@ public class ChunkSampleStream<T extends ChunkSource> implements SampleStream, S
|
||||
this.callback = callback;
|
||||
this.mediaSourceEventDispatcher = mediaSourceEventDispatcher;
|
||||
this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
|
||||
loader = new Loader("Loader:ChunkSampleStream");
|
||||
loader = new Loader("ChunkSampleStream");
|
||||
nextChunkHolder = new ChunkHolder();
|
||||
mediaChunks = new ArrayList<>();
|
||||
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. */
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@ -210,10 +212,12 @@ public final class Loader implements LoaderErrorThrower {
|
||||
@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) {
|
||||
this.downloadExecutorService = Util.newSingleThreadExecutor(threadName);
|
||||
public Loader(String threadNameSuffix) {
|
||||
this.downloadExecutorService =
|
||||
Util.newSingleThreadExecutor(THREAD_NAME_PREFIX + threadNameSuffix);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7392,7 +7392,7 @@ public final class ExoPlayerTest {
|
||||
drmSessionManager,
|
||||
drmEventDispatcher,
|
||||
/* deferOnPrepared= */ false) {
|
||||
private Loader loader = new Loader("oomLoader");
|
||||
private final Loader loader = new Loader("ExoPlayerTest");
|
||||
|
||||
@Override
|
||||
public boolean continueLoading(long positionUs) {
|
||||
|
@ -562,7 +562,7 @@ public final class DashMediaSource extends BaseMediaSource {
|
||||
processManifest(false);
|
||||
} else {
|
||||
dataSource = manifestDataSourceFactory.createDataSource();
|
||||
loader = new Loader("Loader:DashMediaSource");
|
||||
loader = new Loader("DashMediaSource");
|
||||
handler = Util.createHandlerForCurrentLooper();
|
||||
startLoadingManifest();
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ public final class SsMediaSource extends BaseMediaSource
|
||||
processManifest();
|
||||
} else {
|
||||
manifestDataSource = manifestDataSourceFactory.createDataSource();
|
||||
manifestLoader = new Loader("Loader:Manifest");
|
||||
manifestLoader = new Loader("SsMediaSource");
|
||||
manifestLoaderErrorThrower = manifestLoader;
|
||||
manifestRefreshHandler = Util.createHandlerForCurrentLooper();
|
||||
startLoadingManifest();
|
||||
|
Loading…
x
Reference in New Issue
Block a user