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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 int32_t IntraFrameRequest(int stream_index); | 106 int32_t IntraFrameRequest(int stream_index); |
107 int32_t EnableFrameDropper(bool enable); | 107 int32_t EnableFrameDropper(bool enable); |
108 | 108 |
109 void SuspendBelowMinBitrate(); | 109 void SuspendBelowMinBitrate(); |
110 bool VideoSuspended() const; | 110 bool VideoSuspended() const; |
111 | 111 |
112 int64_t TimeUntilNextProcess(); | 112 int64_t TimeUntilNextProcess(); |
113 int32_t Process(); | 113 int32_t Process(); |
114 | 114 |
115 private: | 115 private: |
| 116 |
| 117 struct EncodedFrameStats { |
| 118 EncodedFrameStats() |
| 119 : sum_encode_time_ms(0), |
| 120 max_encode_time_ms(-1), |
| 121 encoded_frames(0) {} |
| 122 |
| 123 void Update(int64_t encode_time_ms); |
| 124 int64_t AvgEncodeTimeMs() { |
| 125 return (encoded_frames > 0) ? (sum_encode_time_ms / encoded_frames) : -1; |
| 126 } |
| 127 int64_t MaxEncodeTimeMs() { |
| 128 return (encoded_frames > 0) ? max_encode_time_ms : -1; |
| 129 } |
| 130 |
| 131 private: |
| 132 int64_t sum_encode_time_ms; // The total encode time of encoded frames. |
| 133 int64_t max_encode_time_ms; // The maximum encode time of encoded frames. |
| 134 size_t encoded_frames; // The number of encoded frames. |
| 135 }; |
| 136 |
| 137 void UpdateHistograms(); |
116 Clock* clock_; | 138 Clock* clock_; |
117 | 139 |
118 rtc::scoped_ptr<CriticalSectionWrapper> process_crit_sect_; | 140 rtc::scoped_ptr<CriticalSectionWrapper> process_crit_sect_; |
119 CriticalSectionWrapper* _sendCritSect; | 141 CriticalSectionWrapper* _sendCritSect; |
120 VCMGenericEncoder* _encoder; | 142 VCMGenericEncoder* _encoder; |
121 VCMEncodedFrameCallback _encodedFrameCallback; | 143 VCMEncodedFrameCallback _encodedFrameCallback; |
122 std::vector<FrameType> _nextFrameTypes; | 144 std::vector<FrameType> _nextFrameTypes; |
123 media_optimization::MediaOptimization _mediaOpt; | 145 media_optimization::MediaOptimization _mediaOpt; |
124 VCMSendStatisticsCallback* _sendStatsCallback; | 146 VCMSendStatisticsCallback* _sendStatsCallback; |
125 VCMCodecDataBase _codecDataBase; | 147 VCMCodecDataBase _codecDataBase; |
126 bool frame_dropper_enabled_; | 148 bool frame_dropper_enabled_; |
127 VCMProcessTimer _sendStatsTimer; | 149 VCMProcessTimer _sendStatsTimer; |
128 | 150 |
129 // Must be accessed on the construction thread of VideoSender. | 151 // Must be accessed on the construction thread of VideoSender. |
130 VideoCodec current_codec_; | 152 VideoCodec current_codec_; |
131 rtc::ThreadChecker main_thread_; | 153 rtc::ThreadChecker main_thread_; |
132 | 154 |
133 VCMQMSettingsCallback* const qm_settings_callback_; | 155 VCMQMSettingsCallback* const qm_settings_callback_; |
134 VCMProtectionCallback* protection_callback_; | 156 VCMProtectionCallback* protection_callback_; |
| 157 |
| 158 EncodedFrameStats stats_; |
135 }; | 159 }; |
136 | 160 |
137 class VideoReceiver { | 161 class VideoReceiver { |
138 public: | 162 public: |
139 typedef VideoCodingModule::ReceiverRobustness ReceiverRobustness; | 163 typedef VideoCodingModule::ReceiverRobustness ReceiverRobustness; |
140 | 164 |
141 VideoReceiver(Clock* clock, EventFactory* event_factory); | 165 VideoReceiver(Clock* clock, EventFactory* event_factory); |
142 ~VideoReceiver(); | 166 ~VideoReceiver(); |
143 | 167 |
144 int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec, | 168 int32_t RegisterReceiveCodec(const VideoCodec* receiveCodec, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 255 |
232 VCMCodecDataBase _codecDataBase GUARDED_BY(_receiveCritSect); | 256 VCMCodecDataBase _codecDataBase GUARDED_BY(_receiveCritSect); |
233 VCMProcessTimer _receiveStatsTimer; | 257 VCMProcessTimer _receiveStatsTimer; |
234 VCMProcessTimer _retransmissionTimer; | 258 VCMProcessTimer _retransmissionTimer; |
235 VCMProcessTimer _keyRequestTimer; | 259 VCMProcessTimer _keyRequestTimer; |
236 }; | 260 }; |
237 | 261 |
238 } // namespace vcm | 262 } // namespace vcm |
239 } // namespace webrtc | 263 } // namespace webrtc |
240 #endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ | 264 #endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ |
OLD | NEW |