OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2017 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.webrtc; | 11 package org.webrtc; |
12 | 12 |
13 /** | 13 /** |
14 * Interface for a video encoder that can be used with WebRTC. All calls will be
made on the | 14 * Interface for a video encoder that can be used with WebRTC. All calls will be
made on the |
15 * encoding thread. | 15 * encoding thread. |
16 */ | 16 */ |
17 public interface VideoEncoder { | 17 public interface VideoEncoder { |
18 /** Settings passed to the encoder by WebRTC. */ | 18 /** Settings passed to the encoder by WebRTC. */ |
19 public class Settings { | 19 public class Settings { |
20 public final int numberOfCores; | 20 public final int numberOfCores; |
21 public final int width; | 21 public final int width; |
22 public final int height; | 22 public final int height; |
23 public final int startBitrate; // Kilobits per second. | 23 public final int startBitrate; // Kilobits per second. |
24 public final int maxFramerate; | 24 public final int maxFramerate; |
| 25 public final boolean automaticResizeOn; |
25 | 26 |
26 public Settings(int numberOfCores, int width, int height, int startBitrate,
int maxFramerate) { | 27 public Settings(int numberOfCores, int width, int height, int startBitrate,
int maxFramerate, |
| 28 boolean automaticResizeOn) { |
27 this.numberOfCores = numberOfCores; | 29 this.numberOfCores = numberOfCores; |
28 this.width = width; | 30 this.width = width; |
29 this.height = height; | 31 this.height = height; |
30 this.startBitrate = startBitrate; | 32 this.startBitrate = startBitrate; |
31 this.maxFramerate = maxFramerate; | 33 this.maxFramerate = maxFramerate; |
| 34 this.automaticResizeOn = automaticResizeOn; |
32 } | 35 } |
33 } | 36 } |
34 | 37 |
35 /** Additional info for encoding. */ | 38 /** Additional info for encoding. */ |
36 public class EncodeInfo { | 39 public class EncodeInfo { |
37 public final EncodedImage.FrameType[] frameTypes; | 40 public final EncodedImage.FrameType[] frameTypes; |
38 | 41 |
39 public EncodeInfo(EncodedImage.FrameType[] frameTypes) { | 42 public EncodeInfo(EncodedImage.FrameType[] frameTypes) { |
40 this.frameTypes = frameTypes; | 43 this.frameTypes = frameTypes; |
41 } | 44 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 sum += bitrate; | 80 sum += bitrate; |
78 } | 81 } |
79 } | 82 } |
80 return sum; | 83 return sum; |
81 } | 84 } |
82 } | 85 } |
83 | 86 |
84 /** Settings for WebRTC quality based scaling. */ | 87 /** Settings for WebRTC quality based scaling. */ |
85 public class ScalingSettings { | 88 public class ScalingSettings { |
86 public final boolean on; | 89 public final boolean on; |
87 public final int low; | 90 public final Integer low; |
88 public final int high; | 91 public final Integer high; |
89 | 92 |
90 /** | 93 /** |
91 * Creates quality based scaling settings. | 94 * Creates quality based scaling setting. |
| 95 * |
| 96 * @param on True if quality scaling is turned on. |
| 97 */ |
| 98 public ScalingSettings(boolean on) { |
| 99 this.on = on; |
| 100 this.low = null; |
| 101 this.high = null; |
| 102 } |
| 103 |
| 104 /** |
| 105 * Creates quality based scaling settings with custom thresholds. |
92 * | 106 * |
93 * @param on True if quality scaling is turned on. | 107 * @param on True if quality scaling is turned on. |
94 * @param low Average QP at which to scale up the resolution. | 108 * @param low Average QP at which to scale up the resolution. |
95 * @param high Average QP at which to scale down the resolution. | 109 * @param high Average QP at which to scale down the resolution. |
96 */ | 110 */ |
97 public ScalingSettings(boolean on, int low, int high) { | 111 public ScalingSettings(boolean on, int low, int high) { |
98 this.on = on; | 112 this.on = on; |
99 this.low = low; | 113 this.low = low; |
100 this.high = high; | 114 this.high = high; |
101 } | 115 } |
(...skipping 20 matching lines...) Expand all Loading... |
122 * Informs the encoder of the packet loss and the round-trip time of the netwo
rk. | 136 * Informs the encoder of the packet loss and the round-trip time of the netwo
rk. |
123 * | 137 * |
124 * @param packetLoss How many packets are lost on average per 255 packets. | 138 * @param packetLoss How many packets are lost on average per 255 packets. |
125 * @param roundTripTimeMs Round-trip time of the network in milliseconds. | 139 * @param roundTripTimeMs Round-trip time of the network in milliseconds. |
126 */ | 140 */ |
127 VideoCodecStatus setChannelParameters(short packetLoss, long roundTripTimeMs); | 141 VideoCodecStatus setChannelParameters(short packetLoss, long roundTripTimeMs); |
128 /** Sets the bitrate allocation and the target framerate for the encoder. */ | 142 /** Sets the bitrate allocation and the target framerate for the encoder. */ |
129 VideoCodecStatus setRateAllocation(BitrateAllocation allocation, int framerate
); | 143 VideoCodecStatus setRateAllocation(BitrateAllocation allocation, int framerate
); |
130 /** Any encoder that wants to use WebRTC provided quality scaler must implemen
t this method. */ | 144 /** Any encoder that wants to use WebRTC provided quality scaler must implemen
t this method. */ |
131 ScalingSettings getScalingSettings(); | 145 ScalingSettings getScalingSettings(); |
132 /** Should return a descriptive name for the implementation. */ | 146 /** Should return a descriptive name for the implementation. Gets called once
and cached. */ |
133 String getImplementationName(); | 147 String getImplementationName(); |
134 } | 148 } |
OLD | NEW |