| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_LOGGING_RECEIVER_TIME_OFFSET_ESTIMATOR_H_ | 5 #ifndef MEDIA_CAST_LOGGING_RECEIVER_TIME_OFFSET_ESTIMATOR_H_ |
| 6 #define MEDIA_CAST_LOGGING_RECEIVER_TIME_OFFSET_ESTIMATOR_H_ | 6 #define MEDIA_CAST_LOGGING_RECEIVER_TIME_OFFSET_ESTIMATOR_H_ |
| 7 | 7 |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "media/cast/logging/raw_event_subscriber.h" | 9 #include "media/cast/logging/raw_event_subscriber.h" |
| 10 | 10 |
| 11 namespace media { | 11 namespace media { |
| 12 namespace cast { | 12 namespace cast { |
| 13 | 13 |
| 14 // Estimates receiver time offset based on raw events received. | 14 // Estimates receiver time offset based on raw events received. |
| 15 // In most cases, the sender and receiver run on different time lines. | 15 // In most cases, the sender and receiver run on different time lines. |
| 16 // In order to convert receiver time back to sender time (or vice versa) | 16 // In order to convert receiver time back to sender time (or vice versa) |
| 17 // a certain time offset has to be applied. | 17 // a certain time offset has to be applied. |
| 18 // An implementation of this interface listens to raw events to figure out | 18 // An implementation of this interface listens to raw events to figure out |
| 19 // the bounds for the offset value (assuming the true offset value is constant | 19 // the bounds for the offset value (assuming the true offset value is constant |
| 20 // over the lifetime of a cast session). | 20 // over the lifetime of a cast session). |
| 21 // The offset values provided here should be used as follows: | 21 // The offset values provided here should be used as follows: |
| 22 // - Convert from sender to receiver time: add offset value to sender timestamp. | 22 // - Convert from sender to receiver time: add offset value to sender timestamp. |
| 23 // - Convert from receiver to sender time: subtract offset value from receiver | 23 // - Convert from receiver to sender time: subtract offset value from receiver |
| 24 // timestamp. | 24 // timestamp. |
| 25 class ReceiverTimeOffsetEstimator : public RawEventSubscriber { | 25 class ReceiverTimeOffsetEstimator : public RawEventSubscriber { |
| 26 public: | 26 public: |
| 27 virtual ~ReceiverTimeOffsetEstimator() {} | 27 ~ReceiverTimeOffsetEstimator() override {} |
| 28 | 28 |
| 29 // If bounds are known, assigns |lower_bound| and |upper_bound| with the | 29 // If bounds are known, assigns |lower_bound| and |upper_bound| with the |
| 30 // lower bound and upper bound for the offset value, respectively. | 30 // lower bound and upper bound for the offset value, respectively. |
| 31 // Returns true if bounds are known. | 31 // Returns true if bounds are known. |
| 32 virtual bool GetReceiverOffsetBounds(base::TimeDelta* lower_bound, | 32 virtual bool GetReceiverOffsetBounds(base::TimeDelta* lower_bound, |
| 33 base::TimeDelta* upper_bound) = 0; | 33 base::TimeDelta* upper_bound) = 0; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 } // namespace cast | 36 } // namespace cast |
| 37 } // namespace media | 37 } // namespace media |
| 38 | 38 |
| 39 #endif // MEDIA_CAST_LOGGING_RECEIVER_TIME_OFFSET_ESTIMATOR_H_ | 39 #endif // MEDIA_CAST_LOGGING_RECEIVER_TIME_OFFSET_ESTIMATOR_H_ |
| OLD | NEW |