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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 VCMFrameBuffer* PopFrame(uint32_t timestamp); | 67 VCMFrameBuffer* PopFrame(uint32_t timestamp); |
68 VCMFrameBuffer* Front() const; | 68 VCMFrameBuffer* Front() const; |
69 VCMFrameBuffer* Back() const; | 69 VCMFrameBuffer* Back() const; |
70 int RecycleFramesUntilKeyFrame(FrameList::iterator* key_frame_it, | 70 int RecycleFramesUntilKeyFrame(FrameList::iterator* key_frame_it, |
71 UnorderedFrameList* free_frames); | 71 UnorderedFrameList* free_frames); |
72 void CleanUpOldOrEmptyFrames(VCMDecodingState* decoding_state, | 72 void CleanUpOldOrEmptyFrames(VCMDecodingState* decoding_state, |
73 UnorderedFrameList* free_frames); | 73 UnorderedFrameList* free_frames); |
74 void Reset(UnorderedFrameList* free_frames); | 74 void Reset(UnorderedFrameList* free_frames); |
75 }; | 75 }; |
76 | 76 |
| 77 class Vp9SsMap { |
| 78 public: |
| 79 typedef std::map<uint32_t, GofInfoVP9, TimestampLessThan> SsMap; |
| 80 bool Insert(const VCMPacket& packet); |
| 81 void Reset(); |
| 82 |
| 83 // Removes SS data that are older than |timestamp|. |
| 84 void RemoveOld(uint32_t timestamp); |
| 85 |
| 86 bool UpdatePacket(VCMPacket* packet) const; |
| 87 void UpdateFrames(FrameList* frames) const; |
| 88 |
| 89 // Public for testing. |
| 90 // Returns an iterator to the corresponding SS data for the input |timestamp|. |
| 91 bool Find(uint32_t timestamp, SsMap::const_iterator* it) const; |
| 92 |
| 93 private: |
| 94 bool TimeForCleanup(uint32_t timestamp) const; |
| 95 void AdvanceFront(uint32_t timestamp); |
| 96 |
| 97 SsMap ss_map_; |
| 98 }; |
| 99 |
77 class VCMJitterBuffer { | 100 class VCMJitterBuffer { |
78 public: | 101 public: |
79 VCMJitterBuffer(Clock* clock, rtc::scoped_ptr<EventWrapper> event); | 102 VCMJitterBuffer(Clock* clock, rtc::scoped_ptr<EventWrapper> event); |
80 | 103 |
81 ~VCMJitterBuffer(); | 104 ~VCMJitterBuffer(); |
82 | 105 |
83 // Initializes and starts jitter buffer. | 106 // Initializes and starts jitter buffer. |
84 void Start(); | 107 void Start(); |
85 | 108 |
86 // Signals all internal events and stops the jitter buffer. | 109 // Signals all internal events and stops the jitter buffer. |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 CriticalSectionWrapper* crit_sect_; | 323 CriticalSectionWrapper* crit_sect_; |
301 // Event to signal when we have a frame ready for decoder. | 324 // Event to signal when we have a frame ready for decoder. |
302 rtc::scoped_ptr<EventWrapper> frame_event_; | 325 rtc::scoped_ptr<EventWrapper> frame_event_; |
303 // Number of allocated frames. | 326 // Number of allocated frames. |
304 int max_number_of_frames_; | 327 int max_number_of_frames_; |
305 UnorderedFrameList free_frames_ GUARDED_BY(crit_sect_); | 328 UnorderedFrameList free_frames_ GUARDED_BY(crit_sect_); |
306 FrameList decodable_frames_ GUARDED_BY(crit_sect_); | 329 FrameList decodable_frames_ GUARDED_BY(crit_sect_); |
307 FrameList incomplete_frames_ GUARDED_BY(crit_sect_); | 330 FrameList incomplete_frames_ GUARDED_BY(crit_sect_); |
308 VCMDecodingState last_decoded_state_ GUARDED_BY(crit_sect_); | 331 VCMDecodingState last_decoded_state_ GUARDED_BY(crit_sect_); |
309 bool first_packet_since_reset_; | 332 bool first_packet_since_reset_; |
310 // Contains last received frame's temporal information for non-flexible mode. | 333 // Contains scalability structure data for VP9. |
311 GofInfoVP9 last_gof_; | 334 Vp9SsMap vp9_ss_map_ GUARDED_BY(crit_sect_); |
312 uint32_t last_gof_timestamp_; | |
313 bool last_gof_valid_; | |
314 | 335 |
315 // Statistics. | 336 // Statistics. |
316 VCMReceiveStatisticsCallback* stats_callback_ GUARDED_BY(crit_sect_); | 337 VCMReceiveStatisticsCallback* stats_callback_ GUARDED_BY(crit_sect_); |
317 // Frame counts for each type (key, delta, ...) | 338 // Frame counts for each type (key, delta, ...) |
318 FrameCounts receive_statistics_; | 339 FrameCounts receive_statistics_; |
319 // Latest calculated frame rates of incoming stream. | 340 // Latest calculated frame rates of incoming stream. |
320 unsigned int incoming_frame_rate_; | 341 unsigned int incoming_frame_rate_; |
321 unsigned int incoming_frame_count_; | 342 unsigned int incoming_frame_count_; |
322 int64_t time_last_incoming_frame_count_; | 343 int64_t time_last_incoming_frame_count_; |
323 unsigned int incoming_bit_count_; | 344 unsigned int incoming_bit_count_; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 // Estimated rolling average of packets per frame | 379 // Estimated rolling average of packets per frame |
359 float average_packets_per_frame_; | 380 float average_packets_per_frame_; |
360 // average_packets_per_frame converges fast if we have fewer than this many | 381 // average_packets_per_frame converges fast if we have fewer than this many |
361 // frames. | 382 // frames. |
362 int frame_counter_; | 383 int frame_counter_; |
363 RTC_DISALLOW_COPY_AND_ASSIGN(VCMJitterBuffer); | 384 RTC_DISALLOW_COPY_AND_ASSIGN(VCMJitterBuffer); |
364 }; | 385 }; |
365 } // namespace webrtc | 386 } // namespace webrtc |
366 | 387 |
367 #endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_JITTER_BUFFER_H_ | 388 #endif // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_JITTER_BUFFER_H_ |
OLD | NEW |