mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Fixed issue in which MediaChunk.seekToStart might not actually seek to the start of the segment.
This commit is contained in:
parent
8cad387393
commit
50b276fe31
@ -73,9 +73,7 @@ public abstract class MediaChunk extends Chunk {
|
|||||||
/**
|
/**
|
||||||
* Seeks to the beginning of the chunk.
|
* Seeks to the beginning of the chunk.
|
||||||
*/
|
*/
|
||||||
public final void seekToStart() {
|
public abstract void seekToStart();
|
||||||
seekTo(startTimeUs, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Seeks to the specified position within the chunk.
|
* Seeks to the specified position within the chunk.
|
||||||
|
@ -54,6 +54,12 @@ public final class Mp4MediaChunk extends MediaChunk {
|
|||||||
this.sampleOffsetUs = sampleOffsetUs;
|
this.sampleOffsetUs = sampleOffsetUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void seekToStart() {
|
||||||
|
extractor.seekTo(0, false);
|
||||||
|
resetReadPosition();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean seekTo(long positionUs, boolean allowNoop) {
|
public boolean seekTo(long positionUs, boolean allowNoop) {
|
||||||
long seekTimeUs = positionUs + sampleOffsetUs;
|
long seekTimeUs = positionUs + sampleOffsetUs;
|
||||||
|
@ -109,6 +109,11 @@ public class SingleSampleMediaChunk extends MediaChunk {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void seekToStart() {
|
||||||
|
resetReadPosition();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean seekTo(long positionUs, boolean allowNoop) {
|
public boolean seekTo(long positionUs, boolean allowNoop) {
|
||||||
resetReadPosition();
|
resetReadPosition();
|
||||||
|
@ -50,6 +50,11 @@ public final class WebmMediaChunk extends MediaChunk {
|
|||||||
this.extractor = extractor;
|
this.extractor = extractor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void seekToStart() {
|
||||||
|
seekTo(0, false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean seekTo(long positionUs, boolean allowNoop) {
|
public boolean seekTo(long positionUs, boolean allowNoop) {
|
||||||
boolean isDiscontinuous = extractor.seekTo(positionUs, allowNoop);
|
boolean isDiscontinuous = extractor.seekTo(positionUs, allowNoop);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user