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 |
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_H_ |
12 #define WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_H_ | 12 #define WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_H_ |
13 | 13 |
14 #include <list> | 14 #include <list> |
15 #include <map> | 15 #include <map> |
| 16 #include <memory> |
16 #include <set> | 17 #include <set> |
17 #include <vector> | 18 #include <vector> |
18 | 19 |
19 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
20 #include "webrtc/base/thread_annotations.h" | 21 #include "webrtc/base/thread_annotations.h" |
21 #include "webrtc/modules/include/module_common_types.h" | 22 #include "webrtc/modules/include/module_common_types.h" |
22 #include "webrtc/modules/video_coding/include/video_coding.h" | 23 #include "webrtc/modules/video_coding/include/video_coding.h" |
23 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | 24 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
24 #include "webrtc/modules/video_coding/decoding_state.h" | 25 #include "webrtc/modules/video_coding/decoding_state.h" |
25 #include "webrtc/modules/video_coding/inter_frame_delay.h" | 26 #include "webrtc/modules/video_coding/inter_frame_delay.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Advances the oldest SS data to handle timestamp wrap in cases where SS data | 97 // Advances the oldest SS data to handle timestamp wrap in cases where SS data |
97 // are received very seldom (e.g. only once in beginning, second when | 98 // are received very seldom (e.g. only once in beginning, second when |
98 // IsNewerTimestamp is not true). | 99 // IsNewerTimestamp is not true). |
99 void AdvanceFront(uint32_t timestamp); | 100 void AdvanceFront(uint32_t timestamp); |
100 | 101 |
101 SsMap ss_map_; | 102 SsMap ss_map_; |
102 }; | 103 }; |
103 | 104 |
104 class VCMJitterBuffer { | 105 class VCMJitterBuffer { |
105 public: | 106 public: |
106 VCMJitterBuffer(Clock* clock, rtc::scoped_ptr<EventWrapper> event); | 107 VCMJitterBuffer(Clock* clock, std::unique_ptr<EventWrapper> event); |
107 | 108 |
108 ~VCMJitterBuffer(); | 109 ~VCMJitterBuffer(); |
109 | 110 |
110 // Initializes and starts jitter buffer. | 111 // Initializes and starts jitter buffer. |
111 void Start(); | 112 void Start(); |
112 | 113 |
113 // Signals all internal events and stops the jitter buffer. | 114 // Signals all internal events and stops the jitter buffer. |
114 void Stop(); | 115 void Stop(); |
115 | 116 |
116 // Returns true if the jitter buffer is running. | 117 // Returns true if the jitter buffer is running. |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 319 |
319 uint16_t EstimatedLowSequenceNumber(const VCMFrameBuffer& frame) const; | 320 uint16_t EstimatedLowSequenceNumber(const VCMFrameBuffer& frame) const; |
320 | 321 |
321 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 322 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
322 | 323 |
323 Clock* clock_; | 324 Clock* clock_; |
324 // If we are running (have started) or not. | 325 // If we are running (have started) or not. |
325 bool running_; | 326 bool running_; |
326 CriticalSectionWrapper* crit_sect_; | 327 CriticalSectionWrapper* crit_sect_; |
327 // Event to signal when we have a frame ready for decoder. | 328 // Event to signal when we have a frame ready for decoder. |
328 rtc::scoped_ptr<EventWrapper> frame_event_; | 329 std::unique_ptr<EventWrapper> frame_event_; |
329 // Number of allocated frames. | 330 // Number of allocated frames. |
330 int max_number_of_frames_; | 331 int max_number_of_frames_; |
331 UnorderedFrameList free_frames_ GUARDED_BY(crit_sect_); | 332 UnorderedFrameList free_frames_ GUARDED_BY(crit_sect_); |
332 FrameList decodable_frames_ GUARDED_BY(crit_sect_); | 333 FrameList decodable_frames_ GUARDED_BY(crit_sect_); |
333 FrameList incomplete_frames_ GUARDED_BY(crit_sect_); | 334 FrameList incomplete_frames_ GUARDED_BY(crit_sect_); |
334 VCMDecodingState last_decoded_state_ GUARDED_BY(crit_sect_); | 335 VCMDecodingState last_decoded_state_ GUARDED_BY(crit_sect_); |
335 bool first_packet_since_reset_; | 336 bool first_packet_since_reset_; |
336 | 337 |
337 // Statistics. | 338 // Statistics. |
338 VCMReceiveStatisticsCallback* stats_callback_ GUARDED_BY(crit_sect_); | 339 VCMReceiveStatisticsCallback* stats_callback_ GUARDED_BY(crit_sect_); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // Estimated rolling average of packets per frame | 381 // Estimated rolling average of packets per frame |
381 float average_packets_per_frame_; | 382 float average_packets_per_frame_; |
382 // average_packets_per_frame converges fast if we have fewer than this many | 383 // average_packets_per_frame converges fast if we have fewer than this many |
383 // frames. | 384 // frames. |
384 int frame_counter_; | 385 int frame_counter_; |
385 RTC_DISALLOW_COPY_AND_ASSIGN(VCMJitterBuffer); | 386 RTC_DISALLOW_COPY_AND_ASSIGN(VCMJitterBuffer); |
386 }; | 387 }; |
387 } // namespace webrtc | 388 } // namespace webrtc |
388 | 389 |
389 #endif // WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_H_ | 390 #endif // WEBRTC_MODULES_VIDEO_CODING_JITTER_BUFFER_H_ |
OLD | NEW |