OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 | 67 |
68 void Destroy(webrtc::VideoEncoder* encoder) override { | 68 void Destroy(webrtc::VideoEncoder* encoder) override { |
69 return factory_->DestroyVideoEncoder(encoder); | 69 return factory_->DestroyVideoEncoder(encoder); |
70 } | 70 } |
71 | 71 |
72 private: | 72 private: |
73 cricket::WebRtcVideoEncoderFactory* const factory_; | 73 cricket::WebRtcVideoEncoderFactory* const factory_; |
74 }; | 74 }; |
75 | 75 |
76 webrtc::Call::Config::BitrateConfig GetBitrateConfigForCodec( | |
77 const VideoCodec& codec) { | |
78 webrtc::Call::Config::BitrateConfig config; | |
79 int bitrate_kbps; | |
80 if (codec.GetParam(kCodecParamMinBitrate, &bitrate_kbps) && | |
81 bitrate_kbps > 0) { | |
82 config.min_bitrate_bps = bitrate_kbps * 1000; | |
83 } else { | |
84 config.min_bitrate_bps = 0; | |
85 } | |
86 if (codec.GetParam(kCodecParamStartBitrate, &bitrate_kbps) && | |
87 bitrate_kbps > 0) { | |
88 config.start_bitrate_bps = bitrate_kbps * 1000; | |
89 } else { | |
90 // Do not reconfigure start bitrate unless it's specified and positive. | |
91 config.start_bitrate_bps = -1; | |
92 } | |
93 if (codec.GetParam(kCodecParamMaxBitrate, &bitrate_kbps) && | |
94 bitrate_kbps > 0) { | |
95 config.max_bitrate_bps = bitrate_kbps * 1000; | |
96 } else { | |
97 config.max_bitrate_bps = -1; | |
98 } | |
99 return config; | |
100 } | |
101 | |
102 // An encoder factory that wraps Create requests for simulcastable codec types | 76 // An encoder factory that wraps Create requests for simulcastable codec types |
103 // with a webrtc::SimulcastEncoderAdapter. Non simulcastable codec type | 77 // with a webrtc::SimulcastEncoderAdapter. Non simulcastable codec type |
104 // requests are just passed through to the contained encoder factory. | 78 // requests are just passed through to the contained encoder factory. |
105 class WebRtcSimulcastEncoderFactory | 79 class WebRtcSimulcastEncoderFactory |
106 : public cricket::WebRtcVideoEncoderFactory { | 80 : public cricket::WebRtcVideoEncoderFactory { |
107 public: | 81 public: |
108 // WebRtcSimulcastEncoderFactory doesn't take ownership of |factory|, which is | 82 // WebRtcSimulcastEncoderFactory doesn't take ownership of |factory|, which is |
109 // owned by e.g. PeerConnectionFactory. | 83 // owned by e.g. PeerConnectionFactory. |
110 explicit WebRtcSimulcastEncoderFactory( | 84 explicit WebRtcSimulcastEncoderFactory( |
111 cricket::WebRtcVideoEncoderFactory* factory) | 85 cricket::WebRtcVideoEncoderFactory* factory) |
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2603 rtx_mapping[video_codecs[i].codec.id] != | 2577 rtx_mapping[video_codecs[i].codec.id] != |
2604 ulpfec_config.red_payload_type) { | 2578 ulpfec_config.red_payload_type) { |
2605 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2579 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2606 } | 2580 } |
2607 } | 2581 } |
2608 | 2582 |
2609 return video_codecs; | 2583 return video_codecs; |
2610 } | 2584 } |
2611 | 2585 |
2612 } // namespace cricket | 2586 } // namespace cricket |
OLD | NEW |