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

Unified Diff: webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java

Issue 2303893002: Limit initial fps value used in Android HW encoder initialization. (Closed)
Patch Set: Address comments Created 4 years, 3 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/android/java/src/org/webrtc/MediaCodecVideoEncoder.java
diff --git a/webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java b/webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java
index 5bc786306f4c98e1b0030ee6eaffc89bf4648550..72544bd83f0babb186b3ba1f1c1d90102d19433a 100644
--- a/webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java
+++ b/webrtc/api/android/java/src/org/webrtc/MediaCodecVideoEncoder.java
@@ -51,6 +51,7 @@ public class MediaCodecVideoEncoder {
private static final int MEDIA_CODEC_RELEASE_TIMEOUT_MS = 5000; // Timeout for codec releasing.
private static final int DEQUEUE_TIMEOUT = 0; // Non-blocking, no wait.
private static final int BITRATE_ADJUSTMENT_FPS = 30;
+ private static final int MAXIMUM_INITIAL_FPS = 30;
// Active running encoder instance. Set in initEncode() (called from native code)
// and reset to null in release() call.
private static MediaCodecVideoEncoder runningInstance = null;
@@ -377,9 +378,12 @@ public class MediaCodecVideoEncoder {
bitrateAdjustmentRequired = properties.bitrateAdjustment;
if (bitrateAdjustmentRequired) {
fps = BITRATE_ADJUSTMENT_FPS;
+ } else {
+ fps = Math.min(fps, MAXIMUM_INITIAL_FPS);
}
Logging.d(TAG, "Color format: " + colorFormat +
- ". Bitrate adjustment: " + bitrateAdjustmentRequired);
+ ". Bitrate adjustment: " + bitrateAdjustmentRequired +
+ ". Initial fps: " + fps);
mediaCodecThread = Thread.currentThread();
try {
@@ -531,7 +535,7 @@ public class MediaCodecVideoEncoder {
Logging.v(TAG, "setRates: " + kbps + " -> " + (codecBitrate / 1000)
+ " kbps. Fps: " + frameRate);
} else {
- Logging.v(TAG, "setRates: " + kbps);
+ Logging.v(TAG, "setRates: " + kbps + " kbps. Fps: " + frameRate);
}
try {
Bundle params = new Bundle();
« 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