mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 19:13:03 +00:00
Reuse callback buffers
This commit is contained in:
parent
3558655b72
commit
55f2e89bbe
@ -469,7 +469,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public int submitDecodeUnit(byte[] frameData) {
|
public int submitDecodeUnit(byte[] frameData, int frameLength) {
|
||||||
totalFrames++;
|
totalFrames++;
|
||||||
|
|
||||||
long timestampUs = System.nanoTime() / 1000;
|
long timestampUs = System.nanoTime() / 1000;
|
||||||
@ -594,7 +594,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
|||||||
|
|
||||||
// The H264Utils.writeSPS function safely handles
|
// The H264Utils.writeSPS function safely handles
|
||||||
// Annex B NALUs (including NALUs with escape sequences)
|
// Annex B NALUs (including NALUs with escape sequences)
|
||||||
ByteBuffer escapedNalu = H264Utils.writeSPS(sps, frameData.length);
|
ByteBuffer escapedNalu = H264Utils.writeSPS(sps, frameLength);
|
||||||
buf.put(escapedNalu);
|
buf.put(escapedNalu);
|
||||||
|
|
||||||
if (queueInputBuffer(inputBufferIndex,
|
if (queueInputBuffer(inputBufferIndex,
|
||||||
@ -634,10 +634,10 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy data from our buffer list into the input buffer
|
// Copy data from our buffer list into the input buffer
|
||||||
buf.put(frameData);
|
buf.put(frameData, 0, frameLength);
|
||||||
|
|
||||||
if (!queueInputBuffer(inputBufferIndex,
|
if (!queueInputBuffer(inputBufferIndex,
|
||||||
0, frameData.length,
|
0, frameLength,
|
||||||
timestampUs, codecFlags)) {
|
timestampUs, codecFlags)) {
|
||||||
return MoonBridge.DR_NEED_IDR;
|
return MoonBridge.DR_NEED_IDR;
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit ea7e5975c30d35ea8b6d79f8fb1235b6d9467cc3
|
Subproject commit 525a8ac322129ee54d674da5d0a3518f6f56ef64
|
Loading…
x
Reference in New Issue
Block a user