Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: webrtc/api/java/src/org/webrtc/MediaCodecVideoDecoder.java

Issue 1725243007: Android MediaCodecVideoDecoder: Limit measured decode time to 200ms (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/java/src/org/webrtc/MediaCodecVideoDecoder.java
diff --git a/webrtc/api/java/src/org/webrtc/MediaCodecVideoDecoder.java b/webrtc/api/java/src/org/webrtc/MediaCodecVideoDecoder.java
index 41fd0791dccd8249f79b600b0951d373a04e52e4..26b1cf2491bcf82fe471bf5f53b571dda8fe948f 100644
--- a/webrtc/api/java/src/org/webrtc/MediaCodecVideoDecoder.java
+++ b/webrtc/api/java/src/org/webrtc/MediaCodecVideoDecoder.java
@@ -41,6 +41,7 @@ public class MediaCodecVideoDecoder {
// possibly to minimize the amount of translation work necessary.
private static final String TAG = "MediaCodecVideoDecoder";
+ private static final long MAX_DECODE_TIME_MS = 200;
// Tracks webrtc::VideoCodecType.
public enum VideoCodecType {
@@ -594,13 +595,19 @@ public class MediaCodecVideoDecoder {
default:
hasDecodedFirstFrame = true;
TimeStamps timeStamps = decodeStartTimeMs.remove();
+ long decodeTimeMs = SystemClock.elapsedRealtime() - timeStamps.decodeStartTimeMs;
+ if (decodeTimeMs > MAX_DECODE_TIME_MS) {
+ Logging.e(TAG, "Very high decode time: " + decodeTimeMs + "ms."
+ + " Might be caused by resuming H264 decoding after a pause.");
+ decodeTimeMs = MAX_DECODE_TIME_MS;
+ }
return new DecodedOutputBuffer(result,
info.offset,
info.size,
TimeUnit.MICROSECONDS.toMillis(info.presentationTimeUs),
timeStamps.timeStampMs,
timeStamps.ntpTimeStampMs,
- SystemClock.elapsedRealtime() - timeStamps.decodeStartTimeMs,
+ decodeTimeMs,
SystemClock.elapsedRealtime());
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698