mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-22 16:26:41 +00:00
Fix codec display after streaming and restore polling behavior of non-direct submit decoders
This commit is contained in:
@@ -424,7 +424,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
int videoFormat = conn.getActiveVideoFormat();
|
int videoFormat = decoderRenderer.getActiveVideoFormat();
|
||||||
|
|
||||||
displayedFailureDialog = true;
|
displayedFailureDialog = true;
|
||||||
stopConnection();
|
stopConnection();
|
||||||
|
|||||||
@@ -133,6 +133,10 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
|||||||
return avcDecoder != null;
|
return avcDecoder != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getActiveVideoFormat() {
|
||||||
|
return this.videoFormat;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setup(int format, int width, int height, int redrawRate) {
|
public boolean setup(int format, int width, int height, int redrawRate) {
|
||||||
this.initialWidth = width;
|
this.initialWidth = width;
|
||||||
@@ -274,7 +278,8 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
|||||||
while (!isInterrupted()) {
|
while (!isInterrupted()) {
|
||||||
try {
|
try {
|
||||||
// Try to output a frame
|
// Try to output a frame
|
||||||
int outIndex = videoDecoder.dequeueOutputBuffer(info, 50000);
|
int outIndex = videoDecoder.dequeueOutputBuffer(info,
|
||||||
|
directSubmit ? 50000 : 0);
|
||||||
if (outIndex >= 0) {
|
if (outIndex >= 0) {
|
||||||
long presentationTimeUs = info.presentationTimeUs;
|
long presentationTimeUs = info.presentationTimeUs;
|
||||||
int lastIndex = outIndex;
|
int lastIndex = outIndex;
|
||||||
@@ -301,6 +306,9 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
|||||||
} else {
|
} else {
|
||||||
switch (outIndex) {
|
switch (outIndex) {
|
||||||
case MediaCodec.INFO_TRY_AGAIN_LATER:
|
case MediaCodec.INFO_TRY_AGAIN_LATER:
|
||||||
|
if (!directSubmit) {
|
||||||
|
Thread.yield();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MediaCodec.INFO_OUTPUT_FORMAT_CHANGED:
|
case MediaCodec.INFO_OUTPUT_FORMAT_CHANGED:
|
||||||
LimeLog.info("Output format changed");
|
LimeLog.info("Output format changed");
|
||||||
@@ -328,7 +336,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
|||||||
startTime = MediaCodecHelper.getMonotonicMillis();
|
startTime = MediaCodecHelper.getMonotonicMillis();
|
||||||
|
|
||||||
while (rendererThread.isAlive() && index < 0) {
|
while (rendererThread.isAlive() && index < 0) {
|
||||||
index = videoDecoder.dequeueInputBuffer(500);
|
index = videoDecoder.dequeueInputBuffer(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
|
|||||||
Submodule moonlight-common updated: e9b406c52e...bda8e3b84d
Reference in New Issue
Block a user