| 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_RTP_RTCP_SOURCE_BITRATE_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_BITRATE_H_ |
| 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_BITRATE_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_BITRATE_H_ |
| 13 | 13 |
| 14 #include <stdio.h> | 14 #include <stdio.h> |
| 15 | 15 |
| 16 #include <list> | 16 #include <list> |
| 17 | 17 |
| 18 #include "webrtc/base/scoped_ptr.h" | 18 #include "webrtc/base/criticalsection.h" |
| 19 #include "webrtc/common_types.h" | 19 #include "webrtc/common_types.h" |
| 20 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" | 20 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" |
| 21 #include "webrtc/typedefs.h" | 21 #include "webrtc/typedefs.h" |
| 22 | 22 |
| 23 namespace webrtc { | 23 namespace webrtc { |
| 24 | 24 |
| 25 class Clock; | 25 class Clock; |
| 26 class CriticalSectionWrapper; | |
| 27 | 26 |
| 28 class Bitrate { | 27 class Bitrate { |
| 29 public: | 28 public: |
| 30 class Observer; | 29 class Observer; |
| 31 Bitrate(Clock* clock, Observer* observer); | 30 Bitrate(Clock* clock, Observer* observer); |
| 32 virtual ~Bitrate(); | 31 virtual ~Bitrate(); |
| 33 | 32 |
| 34 // Calculates rates. | 33 // Calculates rates. |
| 35 void Process(); | 34 void Process(); |
| 36 | 35 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 53 Observer() {} | 52 Observer() {} |
| 54 virtual ~Observer() {} | 53 virtual ~Observer() {} |
| 55 | 54 |
| 56 virtual void BitrateUpdated(const BitrateStatistics& stats) = 0; | 55 virtual void BitrateUpdated(const BitrateStatistics& stats) = 0; |
| 57 }; | 56 }; |
| 58 | 57 |
| 59 protected: | 58 protected: |
| 60 Clock* clock_; | 59 Clock* clock_; |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 rtc::scoped_ptr<CriticalSectionWrapper> crit_; | 62 rtc::CriticalSection crit_; |
| 64 uint32_t packet_rate_; | 63 uint32_t packet_rate_; |
| 65 uint32_t bitrate_; | 64 uint32_t bitrate_; |
| 66 uint8_t bitrate_next_idx_; | 65 uint8_t bitrate_next_idx_; |
| 67 int64_t packet_rate_array_[10]; | 66 int64_t packet_rate_array_[10]; |
| 68 int64_t bitrate_array_[10]; | 67 int64_t bitrate_array_[10]; |
| 69 int64_t bitrate_diff_ms_[10]; | 68 int64_t bitrate_diff_ms_[10]; |
| 70 int64_t time_last_rate_update_; | 69 int64_t time_last_rate_update_; |
| 71 size_t bytes_count_; | 70 size_t bytes_count_; |
| 72 uint32_t packet_count_; | 71 uint32_t packet_count_; |
| 73 Observer* const observer_; | 72 Observer* const observer_; |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 } // namespace webrtc | 75 } // namespace webrtc |
| 77 | 76 |
| 78 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_BITRATE_H_ | 77 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_BITRATE_H_ |
| OLD | NEW |