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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h

Issue 1913073002: Extract common simulcast logic from VP8 wrapper and simulcast adapter (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Bug fix Created 4 years, 7 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
OLDNEW
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 <map>
15 #include <memory> 16 #include <memory>
16 #include <string> 17 #include <string>
18 #include <utility>
17 #include <vector> 19 #include <vector>
18 20
19 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" 21 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
20 22
21 namespace webrtc { 23 namespace webrtc {
22 24
25 class SimulcastState;
26
23 class VideoEncoderFactory { 27 class VideoEncoderFactory {
24 public: 28 public:
25 virtual VideoEncoder* Create() = 0; 29 virtual VideoEncoder* Create() = 0;
26 virtual void Destroy(VideoEncoder* encoder) = 0; 30 virtual void Destroy(VideoEncoder* encoder) = 0;
27 virtual ~VideoEncoderFactory() {} 31 virtual ~VideoEncoderFactory() {}
28 }; 32 };
29 33
30 // SimulcastEncoderAdapter implements simulcast support by creating multiple 34 // SimulcastEncoderAdapter implements simulcast support by creating multiple
31 // webrtc::VideoEncoder instances with the given VideoEncoderFactory. 35 // webrtc::VideoEncoder instances with the given VideoEncoderFactory.
32 // All the public interfaces are expected to be called from the same thread, 36 // 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
84 send_stream(send_stream) {} 88 send_stream(send_stream) {}
85 // Deleted by SimulcastEncoderAdapter::Release(). 89 // Deleted by SimulcastEncoderAdapter::Release().
86 VideoEncoder* encoder; 90 VideoEncoder* encoder;
87 EncodedImageCallback* callback; 91 EncodedImageCallback* callback;
88 uint16_t width; 92 uint16_t width;
89 uint16_t height; 93 uint16_t height;
90 bool key_frame_request; 94 bool key_frame_request;
91 bool send_stream; 95 bool send_stream;
92 }; 96 };
93 97
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.
104 void PopulateStreamCodec(const webrtc::VideoCodec* inst,
105 int stream_index,
106 size_t total_number_of_streams,
107 bool highest_resolution_stream,
108 webrtc::VideoCodec* stream_codec,
109 bool* send_stream);
110
111 bool Initialized() const; 98 bool Initialized() const;
112 99
113 std::unique_ptr<VideoEncoderFactory> factory_; 100 std::unique_ptr<VideoEncoderFactory> factory_;
114 std::unique_ptr<TemporalLayersFactory> screensharing_tl_factory_; 101 std::unique_ptr<TemporalLayersFactory> screensharing_tl_factory_;
115 VideoCodec codec_; 102 VideoCodec codec_;
116 std::vector<StreamInfo> streaminfos_; 103 std::unique_ptr<SimulcastState> stream_states_;
pbos-webrtc 2016/04/29 21:23:27 Can you stack allocate this (e.g. SimulcastState s
104 typedef std::pair<VideoEncoder*, std::unique_ptr<EncodedImageCallback>>
105 EncoderContext;
106 std::map<uint8_t, EncoderContext> encoders_;
117 EncodedImageCallback* encoded_complete_callback_; 107 EncodedImageCallback* encoded_complete_callback_;
118 std::string implementation_name_; 108 std::string implementation_name_;
119 }; 109 };
120 110
121 } // namespace webrtc 111 } // namespace webrtc
122 112
123 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_ 113 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698