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

Side by Side Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/CaptureQualityController.java

Issue 1720283002: Add more camera resolutions to camera scaling slider. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@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 unified diff | Download patch
« no previous file with comments | « webrtc/examples/androidapp/src/org/appspot/apprtc/CallActivity.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 package org.appspot.apprtc; 11 package org.appspot.apprtc;
12 12
13 import android.widget.SeekBar; 13 import android.widget.SeekBar;
14 import android.widget.TextView; 14 import android.widget.TextView;
15 15
16 import org.webrtc.CameraEnumerationAndroid.CaptureFormat; 16 import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
17 17
18 import java.util.Arrays; 18 import java.util.Arrays;
19 import java.util.Collections; 19 import java.util.Collections;
20 import java.util.Comparator; 20 import java.util.Comparator;
21 import java.util.List; 21 import java.util.List;
22 22
23 /** 23 /**
24 * Control capture format based on a seekbar listener. 24 * Control capture format based on a seekbar listener.
25 */ 25 */
26 public class CaptureQualityController implements SeekBar.OnSeekBarChangeListener { 26 public class CaptureQualityController implements SeekBar.OnSeekBarChangeListener {
27 private final List<CaptureFormat> formats = Arrays.asList( 27 private final List<CaptureFormat> formats = Arrays.asList(
28 new CaptureFormat(1280, 720, 0, 30000), 28 new CaptureFormat(1280, 720, 0, 30000),
29 new CaptureFormat(960, 540, 0, 30000),
29 new CaptureFormat(640, 480, 0, 30000), 30 new CaptureFormat(640, 480, 0, 30000),
31 new CaptureFormat(480, 360, 0, 30000),
30 new CaptureFormat(320, 240, 0, 30000), 32 new CaptureFormat(320, 240, 0, 30000),
31 new CaptureFormat(256, 144, 0, 30000)); 33 new CaptureFormat(256, 144, 0, 30000));
32 // Prioritize framerate below this threshold and resolution above the threshol d. 34 // Prioritize framerate below this threshold and resolution above the threshol d.
33 private static final int FRAMERATE_THRESHOLD = 15; 35 private static final int FRAMERATE_THRESHOLD = 15;
34 private TextView captureFormatText; 36 private TextView captureFormatText;
35 private CallFragment.OnCallEvents callEvents; 37 private CallFragment.OnCallEvents callEvents;
36 private int width = 0; 38 private int width = 0;
37 private int height = 0; 39 private int height = 0;
38 private int framerate = 0; 40 private int framerate = 0;
39 private double targetBandwidth = 0; 41 private double targetBandwidth = 0;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 callEvents.onCaptureFormatChange(width, height, framerate); 105 callEvents.onCaptureFormatChange(width, height, framerate);
104 } 106 }
105 107
106 // Return the highest frame rate possible based on bandwidth and format. 108 // Return the highest frame rate possible based on bandwidth and format.
107 private int calculateFramerate(double bandwidth, CaptureFormat format) { 109 private int calculateFramerate(double bandwidth, CaptureFormat format) {
108 return (int) Math.round(Math.min(format.maxFramerate, 110 return (int) Math.round(Math.min(format.maxFramerate,
109 (int) Math.round(bandwidth / (format.width * format.height))) / 1000.0); 111 (int) Math.round(bandwidth / (format.width * format.height))) / 1000.0);
110 } 112 }
111 } 113 }
112 114
OLDNEW
« no previous file with comments | « webrtc/examples/androidapp/src/org/appspot/apprtc/CallActivity.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698