mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Avoid concurrent read/write access to sampleQueues in HlsSampleStreamWrapper
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177435977
This commit is contained in:
parent
ef8fa28163
commit
ce8736c71a
@ -16,12 +16,15 @@
|
||||
package com.google.android.exoplayer2.source.hls;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.Format;
|
||||
import com.google.android.exoplayer2.FormatHolder;
|
||||
import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
|
||||
import com.google.android.exoplayer2.extractor.DummyTrackOutput;
|
||||
import com.google.android.exoplayer2.extractor.ExtractorOutput;
|
||||
import com.google.android.exoplayer2.extractor.SeekMap;
|
||||
import com.google.android.exoplayer2.extractor.TrackOutput;
|
||||
import com.google.android.exoplayer2.source.AdaptiveMediaSourceEventListener.EventDispatcher;
|
||||
import com.google.android.exoplayer2.source.SampleQueue;
|
||||
import com.google.android.exoplayer2.source.SampleQueue.UpstreamFormatChangedListener;
|
||||
@ -67,6 +70,8 @@ import java.util.Arrays;
|
||||
|
||||
}
|
||||
|
||||
private static final String TAG = "HlsSampleStreamWrapper";
|
||||
|
||||
private static final int PRIMARY_TYPE_NONE = 0;
|
||||
private static final int PRIMARY_TYPE_TEXT = 1;
|
||||
private static final int PRIMARY_TYPE_AUDIO = 2;
|
||||
@ -588,13 +593,17 @@ import java.util.Arrays;
|
||||
// ExtractorOutput implementation. Called by the loading thread.
|
||||
|
||||
@Override
|
||||
public SampleQueue track(int id, int type) {
|
||||
public TrackOutput track(int id, int type) {
|
||||
int trackCount = sampleQueues.length;
|
||||
for (int i = 0; i < trackCount; i++) {
|
||||
if (sampleQueueTrackIds[i] == id) {
|
||||
return sampleQueues[i];
|
||||
}
|
||||
}
|
||||
if (sampleQueuesBuilt) {
|
||||
Log.w(TAG, "Unmapped track with id " + id + " of type " + type);
|
||||
return new DummyTrackOutput();
|
||||
}
|
||||
SampleQueue trackOutput = new SampleQueue(allocator);
|
||||
trackOutput.setSampleOffsetUs(sampleOffsetUs);
|
||||
trackOutput.setUpstreamFormatChangeListener(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user