OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 public VideoCaptureCallback { | 50 public VideoCaptureCallback { |
51 public: | 51 public: |
52 friend class ViEBitrateObserver; | 52 friend class ViEBitrateObserver; |
53 | 53 |
54 ViEEncoder(uint32_t number_of_cores, | 54 ViEEncoder(uint32_t number_of_cores, |
55 ProcessThread* module_process_thread, | 55 ProcessThread* module_process_thread, |
56 SendStatisticsProxy* stats_proxy, | 56 SendStatisticsProxy* stats_proxy, |
57 I420FrameCallback* pre_encode_callback, | 57 I420FrameCallback* pre_encode_callback, |
58 OveruseFrameDetector* overuse_detector, | 58 OveruseFrameDetector* overuse_detector, |
59 PacedSender* pacer, | 59 PacedSender* pacer, |
| 60 PayloadRouter* payload_router, |
60 BitrateAllocator* bitrate_allocator); | 61 BitrateAllocator* bitrate_allocator); |
61 ~ViEEncoder(); | 62 ~ViEEncoder(); |
62 | 63 |
63 bool Init(); | 64 bool Init(); |
64 | 65 |
65 // This function is assumed to be called before any frames are delivered and | 66 VideoCodingModule* vcm() const; |
66 // only once. | |
67 // Ideally this would be done in Init, but the dependencies between ViEEncoder | |
68 // and ViEChannel makes it really hard to do in a good way. | |
69 void StartThreadsAndSetSharedMembers( | |
70 rtc::scoped_refptr<PayloadRouter> send_payload_router, | |
71 VCMProtectionCallback* vcm_protection_callback); | |
72 | |
73 // This function must be called before the corresponding ViEChannel is | |
74 // deleted. | |
75 void StopThreadsAndRemoveSharedMembers(); | |
76 | 67 |
77 void SetNetworkTransmissionState(bool is_transmitting); | 68 void SetNetworkTransmissionState(bool is_transmitting); |
78 | 69 |
79 // Returns the id of the owning channel. | 70 // Returns the id of the owning channel. |
80 int Owner() const; | 71 int Owner() const; |
81 | 72 |
82 // Drops incoming packets before they get to the encoder. | 73 // Drops incoming packets before they get to the encoder. |
83 void Pause(); | 74 void Pause(); |
84 void Restart(); | 75 void Restart(); |
85 | 76 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 private: | 142 private: |
152 bool EncoderPaused() const EXCLUSIVE_LOCKS_REQUIRED(data_cs_); | 143 bool EncoderPaused() const EXCLUSIVE_LOCKS_REQUIRED(data_cs_); |
153 void TraceFrameDropStart() EXCLUSIVE_LOCKS_REQUIRED(data_cs_); | 144 void TraceFrameDropStart() EXCLUSIVE_LOCKS_REQUIRED(data_cs_); |
154 void TraceFrameDropEnd() EXCLUSIVE_LOCKS_REQUIRED(data_cs_); | 145 void TraceFrameDropEnd() EXCLUSIVE_LOCKS_REQUIRED(data_cs_); |
155 | 146 |
156 const uint32_t number_of_cores_; | 147 const uint32_t number_of_cores_; |
157 | 148 |
158 const rtc::scoped_ptr<VideoProcessing> vp_; | 149 const rtc::scoped_ptr<VideoProcessing> vp_; |
159 const rtc::scoped_ptr<QMVideoSettingsCallback> qm_callback_; | 150 const rtc::scoped_ptr<QMVideoSettingsCallback> qm_callback_; |
160 const rtc::scoped_ptr<VideoCodingModule> vcm_; | 151 const rtc::scoped_ptr<VideoCodingModule> vcm_; |
161 rtc::scoped_refptr<PayloadRouter> send_payload_router_; | |
162 | 152 |
163 rtc::CriticalSection data_cs_; | 153 rtc::CriticalSection data_cs_; |
164 rtc::scoped_ptr<BitrateObserver> bitrate_observer_; | 154 rtc::scoped_ptr<BitrateObserver> bitrate_observer_; |
165 | 155 |
166 SendStatisticsProxy* const stats_proxy_; | 156 SendStatisticsProxy* const stats_proxy_; |
167 I420FrameCallback* const pre_encode_callback_; | 157 I420FrameCallback* const pre_encode_callback_; |
168 OveruseFrameDetector* const overuse_detector_; | 158 OveruseFrameDetector* const overuse_detector_; |
169 PacedSender* const pacer_; | 159 PacedSender* const pacer_; |
| 160 PayloadRouter* const send_payload_router_; |
170 BitrateAllocator* const bitrate_allocator_; | 161 BitrateAllocator* const bitrate_allocator_; |
171 | 162 |
172 // The time we last received an input frame or encoded frame. This is used to | 163 // The time we last received an input frame or encoded frame. This is used to |
173 // track when video is stopped long enough that we also want to stop sending | 164 // track when video is stopped long enough that we also want to stop sending |
174 // padding. | 165 // padding. |
175 int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_); | 166 int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_); |
176 VideoCodec encoder_config_ GUARDED_BY(data_cs_); | 167 VideoCodec encoder_config_ GUARDED_BY(data_cs_); |
177 int min_transmit_bitrate_kbps_ GUARDED_BY(data_cs_); | 168 int min_transmit_bitrate_kbps_ GUARDED_BY(data_cs_); |
178 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); | 169 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); |
179 int target_delay_ms_ GUARDED_BY(data_cs_); | 170 int target_delay_ms_ GUARDED_BY(data_cs_); |
(...skipping 10 matching lines...) Expand all Loading... |
190 bool has_received_rpsi_ GUARDED_BY(data_cs_); | 181 bool has_received_rpsi_ GUARDED_BY(data_cs_); |
191 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); | 182 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); |
192 std::map<uint32_t, int> ssrc_streams_ GUARDED_BY(data_cs_); | 183 std::map<uint32_t, int> ssrc_streams_ GUARDED_BY(data_cs_); |
193 | 184 |
194 bool video_suspended_ GUARDED_BY(data_cs_); | 185 bool video_suspended_ GUARDED_BY(data_cs_); |
195 }; | 186 }; |
196 | 187 |
197 } // namespace webrtc | 188 } // namespace webrtc |
198 | 189 |
199 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 190 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
OLD | NEW |