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