OLD | NEW |
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 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 } | 62 } |
63 } | 63 } |
64 }; | 64 }; |
65 | 65 |
66 @Override | 66 @Override |
67 public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
{ | 67 public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
{ |
68 if (progress == 0) { | 68 if (progress == 0) { |
69 width = 0; | 69 width = 0; |
70 height = 0; | 70 height = 0; |
71 framerate = 0; | 71 framerate = 0; |
72 captureFormatText.setText("Muted"); | 72 captureFormatText.setText(R.string.muted); |
73 return; | 73 return; |
74 } | 74 } |
75 | 75 |
76 // Extract max bandwidth (in millipixels / second). | 76 // Extract max bandwidth (in millipixels / second). |
77 long maxCaptureBandwidth = java.lang.Long.MIN_VALUE; | 77 long maxCaptureBandwidth = java.lang.Long.MIN_VALUE; |
78 for (CaptureFormat format : formats) { | 78 for (CaptureFormat format : formats) { |
79 maxCaptureBandwidth = Math.max(maxCaptureBandwidth, | 79 maxCaptureBandwidth = Math.max(maxCaptureBandwidth, |
80 (long) format.width * format.height * format.maxFramerate); | 80 (long) format.width * format.height * format.maxFramerate); |
81 } | 81 } |
82 | 82 |
(...skipping 22 matching lines...) Expand all Loading... |
105 callEvents.onCaptureFormatChange(width, height, framerate); | 105 callEvents.onCaptureFormatChange(width, height, framerate); |
106 } | 106 } |
107 | 107 |
108 // Return the highest frame rate possible based on bandwidth and format. | 108 // Return the highest frame rate possible based on bandwidth and format. |
109 private int calculateFramerate(double bandwidth, CaptureFormat format) { | 109 private int calculateFramerate(double bandwidth, CaptureFormat format) { |
110 return (int) Math.round(Math.min(format.maxFramerate, | 110 return (int) Math.round(Math.min(format.maxFramerate, |
111 (int) Math.round(bandwidth / (format.width * format.height))) / 1000.0); | 111 (int) Math.round(bandwidth / (format.width * format.height))) / 1000.0); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
OLD | NEW |