mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Tweak video renderer.
This commit is contained in:
parent
39babb779f
commit
a704b3d338
1 changed files with 13 additions and 13 deletions
|
|
@ -441,6 +441,19 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!renderedFirstFrame) {
|
||||||
|
if (Util.SDK_INT >= 21) {
|
||||||
|
renderOutputBufferV21(codec, bufferIndex, System.nanoTime());
|
||||||
|
} else {
|
||||||
|
renderOutputBuffer(codec, bufferIndex);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getState() != TrackRenderer.STATE_STARTED) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Compute how many microseconds it is until the buffer's presentation time.
|
// Compute how many microseconds it is until the buffer's presentation time.
|
||||||
long elapsedSinceStartOfLoopUs = (SystemClock.elapsedRealtime() * 1000) - elapsedRealtimeUs;
|
long elapsedSinceStartOfLoopUs = (SystemClock.elapsedRealtime() * 1000) - elapsedRealtimeUs;
|
||||||
long earlyUs = bufferInfo.presentationTimeUs - positionUs - elapsedSinceStartOfLoopUs;
|
long earlyUs = bufferInfo.presentationTimeUs - positionUs - elapsedSinceStartOfLoopUs;
|
||||||
|
|
@ -465,19 +478,6 @@ public class MediaCodecVideoTrackRenderer extends MediaCodecTrackRenderer {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!renderedFirstFrame) {
|
|
||||||
if (Util.SDK_INT >= 21) {
|
|
||||||
renderOutputBufferV21(codec, bufferIndex, System.nanoTime());
|
|
||||||
} else {
|
|
||||||
renderOutputBuffer(codec, bufferIndex);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getState() != TrackRenderer.STATE_STARTED) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Util.SDK_INT >= 21) {
|
if (Util.SDK_INT >= 21) {
|
||||||
// Let the underlying framework time the release.
|
// Let the underlying framework time the release.
|
||||||
if (earlyUs < 50000) {
|
if (earlyUs < 50000) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue