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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user