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

Side by Side Diff: webrtc/video/vie_encoder.h

Issue 1713683003: Simplify SSRC usage inside ViEEncoder. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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) 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
11 #ifndef WEBRTC_VIDEO_VIE_ENCODER_H_ 11 #ifndef WEBRTC_VIDEO_VIE_ENCODER_H_
12 #define WEBRTC_VIDEO_VIE_ENCODER_H_ 12 #define WEBRTC_VIDEO_VIE_ENCODER_H_
13 13
14 #include <map>
15 #include <vector> 14 #include <vector>
16 15
17 #include "webrtc/base/criticalsection.h" 16 #include "webrtc/base/criticalsection.h"
18 #include "webrtc/base/scoped_ptr.h" 17 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/base/scoped_ref_ptr.h" 18 #include "webrtc/base/scoped_ref_ptr.h"
20 #include "webrtc/base/thread_annotations.h" 19 #include "webrtc/base/thread_annotations.h"
21 #include "webrtc/call/bitrate_allocator.h" 20 #include "webrtc/call/bitrate_allocator.h"
22 #include "webrtc/common_types.h" 21 #include "webrtc/common_types.h"
23 #include "webrtc/frame_callback.h" 22 #include "webrtc/frame_callback.h"
24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
(...skipping 11 matching lines...) Expand all
36 class OveruseFrameDetector; 35 class OveruseFrameDetector;
37 class PacedSender; 36 class PacedSender;
38 class PayloadRouter; 37 class PayloadRouter;
39 class ProcessThread; 38 class ProcessThread;
40 class QMVideoSettingsCallback; 39 class QMVideoSettingsCallback;
41 class SendStatisticsProxy; 40 class SendStatisticsProxy;
42 class ViEBitrateObserver; 41 class ViEBitrateObserver;
43 class ViEEffectFilter; 42 class ViEEffectFilter;
44 class VideoCodingModule; 43 class VideoCodingModule;
45 44
46 class ViEEncoder : public RtcpIntraFrameObserver, 45 class ViEEncoder : public RtcpIntraFrameObserver,
danilchap 2016/02/19 19:25:56 if you remove inheritence from RtcpIntraFrameObser
pbos-webrtc 2016/02/19 19:30:07 Done.
47 public VideoEncoderRateObserver, 46 public VideoEncoderRateObserver,
48 public VCMPacketizationCallback, 47 public VCMPacketizationCallback,
49 public VCMSendStatisticsCallback, 48 public VCMSendStatisticsCallback,
50 public VideoCaptureCallback { 49 public VideoCaptureCallback {
51 public: 50 public:
52 friend class ViEBitrateObserver; 51 friend class ViEBitrateObserver;
53 52
54 ViEEncoder(uint32_t number_of_cores, 53 ViEEncoder(uint32_t number_of_cores,
54 const std::vector<uint32_t>& ssrcs,
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 PayloadRouter* payload_router,
61 BitrateAllocator* bitrate_allocator); 61 BitrateAllocator* bitrate_allocator);
62 ~ViEEncoder(); 62 ~ViEEncoder();
63 63
64 bool Init(); 64 bool Init();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Implements VideoSendStatisticsCallback. 110 // Implements VideoSendStatisticsCallback.
111 int32_t SendStatistics(const uint32_t bit_rate, 111 int32_t SendStatistics(const uint32_t bit_rate,
112 const uint32_t frame_rate) override; 112 const uint32_t frame_rate) override;
113 113
114 // Implements RtcpIntraFrameObserver. 114 // Implements RtcpIntraFrameObserver.
115 void OnReceivedIntraFrameRequest(uint32_t ssrc) override; 115 void OnReceivedIntraFrameRequest(uint32_t ssrc) override;
116 void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) override; 116 void OnReceivedSLI(uint32_t ssrc, uint8_t picture_id) override;
117 void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) override; 117 void OnReceivedRPSI(uint32_t ssrc, uint64_t picture_id) override;
118 void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) override; 118 void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) override;
119 119
120 // Sets SSRCs for all streams.
121 void SetSsrcs(const std::vector<uint32_t>& ssrcs);
122
123 void SetMinTransmitBitrate(int min_transmit_bitrate_kbps); 120 void SetMinTransmitBitrate(int min_transmit_bitrate_kbps);
124 121
125 // Lets the sender suspend video when the rate drops below 122 // Lets the sender suspend video when the rate drops below
126 // |threshold_bps|, and turns back on when the rate goes back up above 123 // |threshold_bps|, and turns back on when the rate goes back up above
127 // |threshold_bps| + |window_bps|. 124 // |threshold_bps| + |window_bps|.
128 void SuspendBelowMinBitrate(); 125 void SuspendBelowMinBitrate();
129 126
130 // New-style callbacks, used by VideoSendStream. 127 // New-style callbacks, used by VideoSendStream.
131 void RegisterPostEncodeImageCallback( 128 void RegisterPostEncodeImageCallback(
132 EncodedImageCallback* post_encode_callback); 129 EncodedImageCallback* post_encode_callback);
133 130
134 int GetPaddingNeededBps() const; 131 int GetPaddingNeededBps() const;
135 132
136 protected: 133 protected:
137 // Called by BitrateObserver. 134 // Called by BitrateObserver.
138 void OnNetworkChanged(uint32_t bitrate_bps, 135 void OnNetworkChanged(uint32_t bitrate_bps,
139 uint8_t fraction_lost, 136 uint8_t fraction_lost,
140 int64_t round_trip_time_ms); 137 int64_t round_trip_time_ms);
141 138
142 private: 139 private:
143 bool EncoderPaused() const EXCLUSIVE_LOCKS_REQUIRED(data_cs_); 140 bool EncoderPaused() const EXCLUSIVE_LOCKS_REQUIRED(data_cs_);
144 void TraceFrameDropStart() EXCLUSIVE_LOCKS_REQUIRED(data_cs_); 141 void TraceFrameDropStart() EXCLUSIVE_LOCKS_REQUIRED(data_cs_);
145 void TraceFrameDropEnd() EXCLUSIVE_LOCKS_REQUIRED(data_cs_); 142 void TraceFrameDropEnd() EXCLUSIVE_LOCKS_REQUIRED(data_cs_);
146 143
147 const uint32_t number_of_cores_; 144 const uint32_t number_of_cores_;
145 const std::vector<uint32_t> ssrcs_;
148 146
149 const rtc::scoped_ptr<VideoProcessing> vp_; 147 const rtc::scoped_ptr<VideoProcessing> vp_;
150 const rtc::scoped_ptr<QMVideoSettingsCallback> qm_callback_; 148 const rtc::scoped_ptr<QMVideoSettingsCallback> qm_callback_;
151 const rtc::scoped_ptr<VideoCodingModule> vcm_; 149 const rtc::scoped_ptr<VideoCodingModule> vcm_;
152 150
153 rtc::CriticalSection data_cs_; 151 rtc::CriticalSection data_cs_;
154 rtc::scoped_ptr<BitrateObserver> bitrate_observer_; 152 rtc::scoped_ptr<BitrateObserver> bitrate_observer_;
155 153
156 SendStatisticsProxy* const stats_proxy_; 154 SendStatisticsProxy* const stats_proxy_;
157 I420FrameCallback* const pre_encode_callback_; 155 I420FrameCallback* const pre_encode_callback_;
158 OveruseFrameDetector* const overuse_detector_; 156 OveruseFrameDetector* const overuse_detector_;
159 PacedSender* const pacer_; 157 PacedSender* const pacer_;
160 PayloadRouter* const send_payload_router_; 158 PayloadRouter* const send_payload_router_;
161 BitrateAllocator* const bitrate_allocator_; 159 BitrateAllocator* const bitrate_allocator_;
162 160
163 // The time we last received an input frame or encoded frame. This is used to 161 // The time we last received an input frame or encoded frame. This is used to
164 // track when video is stopped long enough that we also want to stop sending 162 // track when video is stopped long enough that we also want to stop sending
165 // padding. 163 // padding.
166 int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_); 164 int64_t time_of_last_frame_activity_ms_ GUARDED_BY(data_cs_);
167 VideoCodec encoder_config_ GUARDED_BY(data_cs_); 165 VideoCodec encoder_config_ GUARDED_BY(data_cs_);
168 int min_transmit_bitrate_kbps_ GUARDED_BY(data_cs_); 166 int min_transmit_bitrate_kbps_ GUARDED_BY(data_cs_);
169 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_); 167 uint32_t last_observed_bitrate_bps_ GUARDED_BY(data_cs_);
170 int target_delay_ms_ GUARDED_BY(data_cs_); 168 int target_delay_ms_ GUARDED_BY(data_cs_);
171 bool network_is_transmitting_ GUARDED_BY(data_cs_); 169 bool network_is_transmitting_ GUARDED_BY(data_cs_);
172 bool encoder_paused_ GUARDED_BY(data_cs_); 170 bool encoder_paused_ GUARDED_BY(data_cs_);
173 bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_); 171 bool encoder_paused_and_dropped_frame_ GUARDED_BY(data_cs_);
174 std::map<unsigned int, int64_t> time_last_intra_request_ms_ 172 std::vector<int64_t> time_last_intra_request_ms_ GUARDED_BY(data_cs_);
175 GUARDED_BY(data_cs_);
176 173
177 ProcessThread* module_process_thread_; 174 ProcessThread* module_process_thread_;
178 175
179 bool has_received_sli_ GUARDED_BY(data_cs_); 176 bool has_received_sli_ GUARDED_BY(data_cs_);
180 uint8_t picture_id_sli_ GUARDED_BY(data_cs_); 177 uint8_t picture_id_sli_ GUARDED_BY(data_cs_);
181 bool has_received_rpsi_ GUARDED_BY(data_cs_); 178 bool has_received_rpsi_ GUARDED_BY(data_cs_);
182 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_); 179 uint64_t picture_id_rpsi_ GUARDED_BY(data_cs_);
183 std::map<uint32_t, int> ssrc_streams_ GUARDED_BY(data_cs_);
184 180
185 bool video_suspended_ GUARDED_BY(data_cs_); 181 bool video_suspended_ GUARDED_BY(data_cs_);
186 }; 182 };
187 183
188 } // namespace webrtc 184 } // namespace webrtc
189 185
190 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ 186 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698