mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Fix incorrect condition.
This commit is contained in:
parent
1c92b28b16
commit
be721943c6
1 changed files with 23 additions and 23 deletions
|
|
@ -375,31 +375,31 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getState() == TrackRenderer.STATE_STARTED && earlyUs < 30000) {
|
if (getState() != TrackRenderer.STATE_STARTED) {
|
||||||
if (Util.SDK_INT >= 21) {
|
return false;
|
||||||
// Let the underlying framework time the release.
|
}
|
||||||
if (earlyUs < 50000) {
|
|
||||||
renderOutputBufferTimedV21(codec, bufferIndex, System.nanoTime() + (earlyUs * 1000L));
|
if (Util.SDK_INT >= 21) {
|
||||||
return true;
|
// Let the underlying framework time the release.
|
||||||
}
|
if (earlyUs < 50000) {
|
||||||
return false;
|
renderOutputBufferTimedV21(codec, bufferIndex, System.nanoTime() + (earlyUs * 1000L));
|
||||||
} else {
|
return true;
|
||||||
// We need to time the release ourselves.
|
}
|
||||||
if (earlyUs < 30000) {
|
} else {
|
||||||
if (earlyUs > 11000) {
|
// We need to time the release ourselves.
|
||||||
// We're a little too early to render the frame. Sleep until the frame can be rendered.
|
if (earlyUs < 30000) {
|
||||||
// Note: The 11ms threshold was chosen fairly arbitrarily.
|
if (earlyUs > 11000) {
|
||||||
try {
|
// We're a little too early to render the frame. Sleep until the frame can be rendered.
|
||||||
// Subtracting 10000 rather than 11000 ensures the sleep time will be at least 1ms.
|
// Note: The 11ms threshold was chosen fairly arbitrarily.
|
||||||
Thread.sleep((earlyUs - 10000) / 1000);
|
try {
|
||||||
} catch (InterruptedException e) {
|
// Subtracting 10000 rather than 11000 ensures the sleep time will be at least 1ms.
|
||||||
Thread.currentThread().interrupt();
|
Thread.sleep((earlyUs - 10000) / 1000);
|
||||||
}
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
renderOutputBufferImmediate(codec, bufferIndex);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
renderOutputBufferImmediate(codec, bufferIndex);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue