OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 10 matching lines...) Expand all Loading... |
21 #include "webrtc/base/event.h" | 21 #include "webrtc/base/event.h" |
22 #include "webrtc/base/thread_annotations.h" | 22 #include "webrtc/base/thread_annotations.h" |
23 #include "webrtc/modules/video_coding/frame_object.h" | 23 #include "webrtc/modules/video_coding/frame_object.h" |
24 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | 24 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
25 #include "webrtc/modules/video_coding/inter_frame_delay.h" | 25 #include "webrtc/modules/video_coding/inter_frame_delay.h" |
26 #include "webrtc/modules/video_coding/sequence_number_util.h" | 26 #include "webrtc/modules/video_coding/sequence_number_util.h" |
27 | 27 |
28 namespace webrtc { | 28 namespace webrtc { |
29 | 29 |
30 class Clock; | 30 class Clock; |
| 31 class VCMReceiveStatisticsCallback; |
31 class VCMJitterEstimator; | 32 class VCMJitterEstimator; |
32 class VCMTiming; | 33 class VCMTiming; |
33 | 34 |
34 namespace video_coding { | 35 namespace video_coding { |
35 | 36 |
36 class FrameBuffer { | 37 class FrameBuffer { |
37 public: | 38 public: |
38 enum ReturnReason { kFrameFound, kTimeout, kStopped }; | 39 enum ReturnReason { kFrameFound, kTimeout, kStopped }; |
39 | 40 |
40 FrameBuffer(Clock* clock, | 41 FrameBuffer(Clock* clock, |
41 VCMJitterEstimator* jitter_estimator, | 42 VCMJitterEstimator* jitter_estimator, |
42 VCMTiming* timing); | 43 VCMTiming* timing, |
| 44 VCMReceiveStatisticsCallback* stats_proxy); |
43 | 45 |
44 virtual ~FrameBuffer(); | 46 virtual ~FrameBuffer(); |
45 | 47 |
46 // Insert a frame into the frame buffer. Returns the picture id | 48 // Insert a frame into the frame buffer. Returns the picture id |
47 // of the last continuous frame or -1 if there is no continuous frame. | 49 // of the last continuous frame or -1 if there is no continuous frame. |
48 int InsertFrame(std::unique_ptr<FrameObject> frame); | 50 int InsertFrame(std::unique_ptr<FrameObject> frame); |
49 | 51 |
50 // Get the next frame for decoding. Will return at latest after | 52 // Get the next frame for decoding. Will return at latest after |
51 // |max_wait_time_ms|. | 53 // |max_wait_time_ms|. |
52 // - If a frame is available within |max_wait_time_ms| it will return | 54 // - If a frame is available within |max_wait_time_ms| it will return |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 136 |
135 // Update the corresponding FrameInfo of |frame| and all FrameInfos that | 137 // Update the corresponding FrameInfo of |frame| and all FrameInfos that |
136 // |frame| references. | 138 // |frame| references. |
137 // Return false if |frame| will never be decodable, true otherwise. | 139 // Return false if |frame| will never be decodable, true otherwise. |
138 bool UpdateFrameInfoWithIncomingFrame(const FrameObject& frame, | 140 bool UpdateFrameInfoWithIncomingFrame(const FrameObject& frame, |
139 FrameMap::iterator info) | 141 FrameMap::iterator info) |
140 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 142 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
141 | 143 |
142 void UpdateJitterDelay() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 144 void UpdateJitterDelay() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
143 | 145 |
144 void UpdateHistograms() const; | |
145 | |
146 FrameMap frames_ GUARDED_BY(crit_); | 146 FrameMap frames_ GUARDED_BY(crit_); |
147 | 147 |
148 rtc::CriticalSection crit_; | 148 rtc::CriticalSection crit_; |
149 Clock* const clock_; | 149 Clock* const clock_; |
150 rtc::Event new_countinuous_frame_event_; | 150 rtc::Event new_countinuous_frame_event_; |
151 VCMJitterEstimator* const jitter_estimator_ GUARDED_BY(crit_); | 151 VCMJitterEstimator* const jitter_estimator_ GUARDED_BY(crit_); |
152 VCMTiming* const timing_ GUARDED_BY(crit_); | 152 VCMTiming* const timing_ GUARDED_BY(crit_); |
153 VCMInterFrameDelay inter_frame_delay_ GUARDED_BY(crit_); | 153 VCMInterFrameDelay inter_frame_delay_ GUARDED_BY(crit_); |
154 FrameMap::iterator last_decoded_frame_it_ GUARDED_BY(crit_); | 154 FrameMap::iterator last_decoded_frame_it_ GUARDED_BY(crit_); |
155 FrameMap::iterator last_continuous_frame_it_ GUARDED_BY(crit_); | 155 FrameMap::iterator last_continuous_frame_it_ GUARDED_BY(crit_); |
156 int num_frames_history_ GUARDED_BY(crit_); | 156 int num_frames_history_ GUARDED_BY(crit_); |
157 int num_frames_buffered_ GUARDED_BY(crit_); | 157 int num_frames_buffered_ GUARDED_BY(crit_); |
158 bool stopped_ GUARDED_BY(crit_); | 158 bool stopped_ GUARDED_BY(crit_); |
159 VCMVideoProtection protection_mode_ GUARDED_BY(crit_); | 159 VCMVideoProtection protection_mode_ GUARDED_BY(crit_); |
| 160 VCMReceiveStatisticsCallback* const stats_callback_; |
160 | 161 |
161 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FrameBuffer); | 162 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FrameBuffer); |
162 | |
163 // For WebRTC.Video.JitterBufferDelayInMs metric. | |
164 int64_t accumulated_delay_ = 0; | |
165 int64_t accumulated_delay_samples_ = 0; | |
166 | |
167 // For WebRTC.Video.KeyFramesReceivedInPermille metric. | |
168 int64_t num_total_frames_ = 0; | |
169 int64_t num_key_frames_ = 0; | |
170 }; | 163 }; |
171 | 164 |
172 } // namespace video_coding | 165 } // namespace video_coding |
173 } // namespace webrtc | 166 } // namespace webrtc |
174 | 167 |
175 #endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_ | 168 #endif // WEBRTC_MODULES_VIDEO_CODING_FRAME_BUFFER2_H_ |
OLD | NEW |