mirror of
https://github.com/samsonjs/media.git
synced 2026-04-10 12:05:47 +00:00
Move CachedRegionTracker to upstream root
PiperOrigin-RevId: 403914807
This commit is contained in:
parent
18cf01cda6
commit
a4c1005823
3 changed files with 13 additions and 11 deletions
|
|
@ -14,6 +14,8 @@
|
|||
`com.google.android.exoplayer2.DeviceInfo`.
|
||||
* Move `com.google.android.exoplayer2.drm.DecryptionException` to
|
||||
`com.google.android.exoplayer2.decoder.CryptoException`.
|
||||
* Move `com.google.android.exoplayer2.upstream.cache.CachedRegionTracker`
|
||||
to `com.google.android.exoplayer2.upstream.CachedRegionTracker`.
|
||||
* Make `ExoPlayer.Builder` return a `SimpleExoPlayer` instance.
|
||||
* Deprecate `SimpleExoPlayer.Builder`. Use `ExoPlayer.Builder` instead.
|
||||
* Remove `ExoPlayerLibraryInfo.GL_ASSERTIONS_ENABLED`. Use
|
||||
|
|
|
|||
|
|
@ -13,10 +13,12 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer2.upstream.cache;
|
||||
package com.google.android.exoplayer2.upstream;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.exoplayer2.extractor.ChunkIndex;
|
||||
import com.google.android.exoplayer2.upstream.cache.Cache;
|
||||
import com.google.android.exoplayer2.upstream.cache.CacheSpan;
|
||||
import com.google.android.exoplayer2.util.Log;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import java.util.Arrays;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.google.android.exoplayer2.upstream.cache;
|
||||
package com.google.android.exoplayer2.upstream;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
|
|
@ -23,7 +23,8 @@ import static org.mockito.Mockito.when;
|
|||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.android.exoplayer2.extractor.ChunkIndex;
|
||||
import com.google.android.exoplayer2.testutil.TestUtil;
|
||||
import com.google.android.exoplayer2.upstream.cache.Cache;
|
||||
import com.google.android.exoplayer2.upstream.cache.CacheSpan;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
|
@ -56,7 +57,6 @@ public final class CachedRegionTrackerTest {
|
|||
@Mock private Cache cache;
|
||||
private CachedRegionTracker tracker;
|
||||
|
||||
private CachedContentIndex index;
|
||||
private File cacheDir;
|
||||
|
||||
@Before
|
||||
|
|
@ -66,7 +66,6 @@ public final class CachedRegionTrackerTest {
|
|||
tracker = new CachedRegionTracker(cache, CACHE_KEY, CHUNK_INDEX);
|
||||
cacheDir =
|
||||
Util.createTempDirectory(ApplicationProvider.getApplicationContext(), "ExoPlayerTest");
|
||||
index = new CachedContentIndex(TestUtil.getInMemoryDatabaseProvider());
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
@ -128,14 +127,13 @@ public final class CachedRegionTrackerTest {
|
|||
}
|
||||
|
||||
private CacheSpan newCacheSpan(int position, int length) throws IOException {
|
||||
int id = index.assignIdForKey(CACHE_KEY);
|
||||
File cacheFile = createCacheSpanFile(cacheDir, id, position, length, 0);
|
||||
return SimpleCacheSpan.createCacheEntry(cacheFile, length, index);
|
||||
File cacheFile = createCacheSpanFile(cacheDir, position, length);
|
||||
return new CacheSpan(CACHE_KEY, position, length, /* lastTouchTimestamp= */ 0, cacheFile);
|
||||
}
|
||||
|
||||
public static File createCacheSpanFile(
|
||||
File cacheDir, int id, long offset, int length, long lastTouchTimestamp) throws IOException {
|
||||
File cacheFile = SimpleCacheSpan.getCacheFile(cacheDir, id, offset, lastTouchTimestamp);
|
||||
public static File createCacheSpanFile(File cacheDir, long position, int length)
|
||||
throws IOException {
|
||||
File cacheFile = new File(cacheDir, "test." + position);
|
||||
createTestFile(cacheFile, length);
|
||||
return cacheFile;
|
||||
}
|
||||
Loading…
Reference in a new issue