| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_CAST_CAST_DEFINES_H_ | 5 #ifndef MEDIA_CAST_CAST_DEFINES_H_ |
| 6 #define MEDIA_CAST_CAST_DEFINES_H_ | 6 #define MEDIA_CAST_CAST_DEFINES_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "media/cast/transport/cast_transport_config.h" | 17 #include "media/cast/net/cast_transport_config.h" |
| 18 | 18 |
| 19 namespace media { | 19 namespace media { |
| 20 namespace cast { | 20 namespace cast { |
| 21 | 21 |
| 22 const int64 kDontShowTimeoutMs = 33; | 22 const int64 kDontShowTimeoutMs = 33; |
| 23 const float kDefaultCongestionControlBackOff = 0.875f; | 23 const float kDefaultCongestionControlBackOff = 0.875f; |
| 24 const uint32 kVideoFrequency = 90000; | 24 const uint32 kVideoFrequency = 90000; |
| 25 const uint32 kStartFrameId = UINT32_C(0xffffffff); | 25 const uint32 kStartFrameId = UINT32_C(0xffffffff); |
| 26 | 26 |
| 27 // This is an important system-wide constant. This limits how much history the | 27 // This is an important system-wide constant. This limits how much history the |
| 28 // implementation must retain in order to process the acknowledgements of past | 28 // implementation must retain in order to process the acknowledgements of past |
| 29 // frames. | 29 // frames. |
| 30 const int kMaxUnackedFrames = 255; | 30 const int kMaxUnackedFrames = 255; |
| 31 | 31 |
| 32 const size_t kMaxIpPacketSize = 1500; | |
| 33 const int kStartRttMs = 20; | 32 const int kStartRttMs = 20; |
| 34 const int64 kCastMessageUpdateIntervalMs = 33; | 33 const int64 kCastMessageUpdateIntervalMs = 33; |
| 35 const int64 kNackRepeatIntervalMs = 30; | 34 const int64 kNackRepeatIntervalMs = 30; |
| 36 | 35 |
| 37 enum CastInitializationStatus { | 36 enum CastInitializationStatus { |
| 38 STATUS_AUDIO_UNINITIALIZED, | 37 STATUS_AUDIO_UNINITIALIZED, |
| 39 STATUS_VIDEO_UNINITIALIZED, | 38 STATUS_VIDEO_UNINITIALIZED, |
| 40 STATUS_AUDIO_INITIALIZED, | 39 STATUS_AUDIO_INITIALIZED, |
| 41 STATUS_VIDEO_INITIALIZED, | 40 STATUS_VIDEO_INITIALIZED, |
| 42 STATUS_INVALID_CAST_ENVIRONMENT, | 41 STATUS_INVALID_CAST_ENVIRONMENT, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ntp_time_us - | 185 ntp_time_us - |
| 187 (kUnixEpochInNtpSeconds * base::Time::kMicrosecondsPerSecond)); | 186 (kUnixEpochInNtpSeconds * base::Time::kMicrosecondsPerSecond)); |
| 188 return base::TimeTicks::UnixEpoch() + elapsed_since_unix_epoch; | 187 return base::TimeTicks::UnixEpoch() + elapsed_since_unix_epoch; |
| 189 } | 188 } |
| 190 | 189 |
| 191 inline base::TimeDelta RtpDeltaToTimeDelta(int64 rtp_delta, int rtp_timebase) { | 190 inline base::TimeDelta RtpDeltaToTimeDelta(int64 rtp_delta, int rtp_timebase) { |
| 192 DCHECK_GT(rtp_timebase, 0); | 191 DCHECK_GT(rtp_timebase, 0); |
| 193 return rtp_delta * base::TimeDelta::FromSeconds(1) / rtp_timebase; | 192 return rtp_delta * base::TimeDelta::FromSeconds(1) / rtp_timebase; |
| 194 } | 193 } |
| 195 | 194 |
| 196 inline uint32 GetVideoRtpTimestamp(const base::TimeTicks& time_ticks) { | |
| 197 base::TimeTicks zero_time; | |
| 198 base::TimeDelta recorded_delta = time_ticks - zero_time; | |
| 199 // Timestamp is in 90 KHz for video. | |
| 200 return static_cast<uint32>(recorded_delta.InMilliseconds() * 90); | |
| 201 } | |
| 202 | |
| 203 } // namespace cast | 195 } // namespace cast |
| 204 } // namespace media | 196 } // namespace media |
| 205 | 197 |
| 206 #endif // MEDIA_CAST_CAST_DEFINES_H_ | 198 #endif // MEDIA_CAST_CAST_DEFINES_H_ |
| OLD | NEW |