Really fix stop() in samplePlayer when using MediaCodec mode

Make getBufferPercentage() and getPosition() work when the
media is reset.

Change-Id: I7d696fd9b5c62b42aa0d29348e73f1f5755eb075
Signed-off-by: Lajos Molnar <lajos@google.com>
Bug: 9516405
This commit is contained in:
Lajos Molnar
2013-06-28 08:05:37 -07:00
parent 39fa902e87
commit d5f85fd131

View File

@@ -649,6 +649,10 @@ class MediaCodecView extends SurfaceView
}
public int getCurrentPosition() {
if (mCodecStates == null) {
return 0;
}
long positionUs = 0;
for (CodecState state : mCodecStates.values()) {
@@ -683,6 +687,10 @@ class MediaCodecView extends SurfaceView
}
public int getBufferPercentage() {
if (mExtractor == null) {
return 0;
}
long cachedDurationUs = mExtractor.getCachedDuration();
if (cachedDurationUs < 0 || mDurationUs < 0) {