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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class VideoCodingModule; | 42 class VideoCodingModule; |
43 | 43 |
44 class ViEEncoder : public RtcpIntraFrameObserver, | 44 class ViEEncoder : public RtcpIntraFrameObserver, |
45 public VideoEncoderRateObserver, | 45 public VideoEncoderRateObserver, |
46 public VCMPacketizationCallback, | 46 public VCMPacketizationCallback, |
47 public VCMSendStatisticsCallback, | 47 public VCMSendStatisticsCallback, |
48 public VideoCaptureCallback { | 48 public VideoCaptureCallback { |
49 public: | 49 public: |
50 friend class ViEBitrateObserver; | 50 friend class ViEBitrateObserver; |
51 | 51 |
52 ViEEncoder(int32_t channel_id, | 52 ViEEncoder(uint32_t number_of_cores, |
53 uint32_t number_of_cores, | |
54 ProcessThread* module_process_thread, | 53 ProcessThread* module_process_thread, |
55 SendStatisticsProxy* stats_proxy, | 54 SendStatisticsProxy* stats_proxy, |
56 I420FrameCallback* pre_encode_callback, | 55 I420FrameCallback* pre_encode_callback, |
57 PacedSender* pacer, | 56 PacedSender* pacer, |
58 BitrateAllocator* bitrate_allocator); | 57 BitrateAllocator* bitrate_allocator); |
59 ~ViEEncoder(); | 58 ~ViEEncoder(); |
60 | 59 |
61 bool Init(); | 60 bool Init(); |
62 | 61 |
63 // This function is assumed to be called before any frames are delivered and | 62 // This function is assumed to be called before any frames are delivered and |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 137 |
139 // Lets the sender suspend video when the rate drops below | 138 // Lets the sender suspend video when the rate drops below |
140 // |threshold_bps|, and turns back on when the rate goes back up above | 139 // |threshold_bps|, and turns back on when the rate goes back up above |
141 // |threshold_bps| + |window_bps|. | 140 // |threshold_bps| + |window_bps|. |
142 void SuspendBelowMinBitrate(); | 141 void SuspendBelowMinBitrate(); |
143 | 142 |
144 // New-style callbacks, used by VideoSendStream. | 143 // New-style callbacks, used by VideoSendStream. |
145 void RegisterPostEncodeImageCallback( | 144 void RegisterPostEncodeImageCallback( |
146 EncodedImageCallback* post_encode_callback); | 145 EncodedImageCallback* post_encode_callback); |
147 | 146 |
148 int channel_id() const { return channel_id_; } | |
149 | |
150 int GetPaddingNeededBps() const; | 147 int GetPaddingNeededBps() const; |
151 | 148 |
152 protected: | 149 protected: |
153 // Called by BitrateObserver. | 150 // Called by BitrateObserver. |
154 void OnNetworkChanged(uint32_t bitrate_bps, | 151 void OnNetworkChanged(uint32_t bitrate_bps, |
155 uint8_t fraction_lost, | 152 uint8_t fraction_lost, |
156 int64_t round_trip_time_ms); | 153 int64_t round_trip_time_ms); |
157 | 154 |
158 private: | 155 private: |
159 bool EncoderPaused() const EXCLUSIVE_LOCKS_REQUIRED(data_cs_); | 156 bool EncoderPaused() const EXCLUSIVE_LOCKS_REQUIRED(data_cs_); |
160 void TraceFrameDropStart() EXCLUSIVE_LOCKS_REQUIRED(data_cs_); | 157 void TraceFrameDropStart() EXCLUSIVE_LOCKS_REQUIRED(data_cs_); |
161 void TraceFrameDropEnd() EXCLUSIVE_LOCKS_REQUIRED(data_cs_); | 158 void TraceFrameDropEnd() EXCLUSIVE_LOCKS_REQUIRED(data_cs_); |
162 | 159 |
163 const int channel_id_; | |
164 const uint32_t number_of_cores_; | 160 const uint32_t number_of_cores_; |
165 | 161 |
166 const rtc::scoped_ptr<VideoProcessingModule> vpm_; | 162 const rtc::scoped_ptr<VideoProcessingModule> vpm_; |
167 const rtc::scoped_ptr<QMVideoSettingsCallback> qm_callback_; | 163 const rtc::scoped_ptr<QMVideoSettingsCallback> qm_callback_; |
168 const rtc::scoped_ptr<VideoCodingModule> vcm_; | 164 const rtc::scoped_ptr<VideoCodingModule> vcm_; |
169 rtc::scoped_refptr<PayloadRouter> send_payload_router_; | 165 rtc::scoped_refptr<PayloadRouter> send_payload_router_; |
170 | 166 |
171 rtc::scoped_ptr<CriticalSectionWrapper> data_cs_; | 167 rtc::scoped_ptr<CriticalSectionWrapper> data_cs_; |
172 rtc::scoped_ptr<BitrateObserver> bitrate_observer_; | 168 rtc::scoped_ptr<BitrateObserver> bitrate_observer_; |
173 | 169 |
(...skipping 26 matching lines...) Expand all Loading... |
200 bool has_received_rpsi_ GUARDED_BY(data_cs_); | 196 bool has_received_rpsi_ GUARDED_BY(data_cs_); |
201 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); | 197 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); |
202 std::map<uint32_t, int> ssrc_streams_ GUARDED_BY(data_cs_); | 198 std::map<uint32_t, int> ssrc_streams_ GUARDED_BY(data_cs_); |
203 | 199 |
204 bool video_suspended_ GUARDED_BY(data_cs_); | 200 bool video_suspended_ GUARDED_BY(data_cs_); |
205 }; | 201 }; |
206 | 202 |
207 } // namespace webrtc | 203 } // namespace webrtc |
208 | 204 |
209 #endif // WEBRTC_VIDEO_ENGINE_VIE_ENCODER_H_ | 205 #endif // WEBRTC_VIDEO_ENGINE_VIE_ENCODER_H_ |
OLD | NEW |