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 */ |
11 | 11 |
12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_ | 12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_ |
13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_ | 13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_ |
14 | 14 |
15 #include <memory> | 15 #include <memory> |
16 #include <string> | 16 #include <string> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 19 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
20 | 20 |
21 namespace webrtc { | 21 namespace webrtc { |
22 | 22 |
| 23 class SimulcastRateAllocator; |
| 24 |
23 class VideoEncoderFactory { | 25 class VideoEncoderFactory { |
24 public: | 26 public: |
25 virtual VideoEncoder* Create() = 0; | 27 virtual VideoEncoder* Create() = 0; |
26 virtual void Destroy(VideoEncoder* encoder) = 0; | 28 virtual void Destroy(VideoEncoder* encoder) = 0; |
27 virtual ~VideoEncoderFactory() {} | 29 virtual ~VideoEncoderFactory() {} |
28 }; | 30 }; |
29 | 31 |
30 // SimulcastEncoderAdapter implements simulcast support by creating multiple | 32 // SimulcastEncoderAdapter implements simulcast support by creating multiple |
31 // webrtc::VideoEncoder instances with the given VideoEncoderFactory. | 33 // webrtc::VideoEncoder instances with the given VideoEncoderFactory. |
32 // All the public interfaces are expected to be called from the same thread, | 34 // All the public interfaces are expected to be called from the same thread, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 send_stream(send_stream) {} | 86 send_stream(send_stream) {} |
85 // Deleted by SimulcastEncoderAdapter::Release(). | 87 // Deleted by SimulcastEncoderAdapter::Release(). |
86 VideoEncoder* encoder; | 88 VideoEncoder* encoder; |
87 EncodedImageCallback* callback; | 89 EncodedImageCallback* callback; |
88 uint16_t width; | 90 uint16_t width; |
89 uint16_t height; | 91 uint16_t height; |
90 bool key_frame_request; | 92 bool key_frame_request; |
91 bool send_stream; | 93 bool send_stream; |
92 }; | 94 }; |
93 | 95 |
94 // Get the stream bitrate, for the stream |stream_idx|, given the bitrate | |
95 // |new_bitrate_kbit| and the actual configured stream count in | |
96 // |total_number_of_streams|. The function also returns whether there's enough | |
97 // bandwidth to send this stream via |send_stream|. | |
98 uint32_t GetStreamBitrate(int stream_idx, | |
99 size_t total_number_of_streams, | |
100 uint32_t new_bitrate_kbit, | |
101 bool* send_stream) const; | |
102 | |
103 // Populate the codec settings for each stream. | 96 // Populate the codec settings for each stream. |
104 void PopulateStreamCodec(const webrtc::VideoCodec* inst, | 97 void PopulateStreamCodec(const webrtc::VideoCodec* inst, |
105 int stream_index, | 98 int stream_index, |
106 size_t total_number_of_streams, | 99 uint32_t start_bitrate_kbps, |
107 bool highest_resolution_stream, | 100 bool highest_resolution_stream, |
108 webrtc::VideoCodec* stream_codec, | 101 webrtc::VideoCodec* stream_codec, |
109 bool* send_stream); | 102 bool* send_stream); |
110 | 103 |
111 bool Initialized() const; | 104 bool Initialized() const; |
112 | 105 |
113 std::unique_ptr<VideoEncoderFactory> factory_; | 106 std::unique_ptr<VideoEncoderFactory> factory_; |
114 std::unique_ptr<TemporalLayersFactory> screensharing_tl_factory_; | 107 std::unique_ptr<TemporalLayersFactory> screensharing_tl_factory_; |
115 VideoCodec codec_; | 108 VideoCodec codec_; |
116 std::vector<StreamInfo> streaminfos_; | 109 std::vector<StreamInfo> streaminfos_; |
117 EncodedImageCallback* encoded_complete_callback_; | 110 EncodedImageCallback* encoded_complete_callback_; |
118 std::string implementation_name_; | 111 std::string implementation_name_; |
| 112 std::unique_ptr<SimulcastRateAllocator> rate_allocator_; |
119 }; | 113 }; |
120 | 114 |
121 } // namespace webrtc | 115 } // namespace webrtc |
122 | 116 |
123 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_ | 117 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_ |
OLD | NEW |