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 #include "media/cast/logging/raw_event_subscriber_bundle.h" | 5 #include "media/cast/logging/raw_event_subscriber_bundle.h" |
6 | 6 |
7 #include "media/cast/cast_environment.h" | 7 #include "media/cast/cast_environment.h" |
8 #include "media/cast/logging/receiver_time_offset_estimator_impl.h" | 8 #include "media/cast/logging/receiver_time_offset_estimator_impl.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 RawEventSubscriberBundle::~RawEventSubscriberBundle() { | 47 RawEventSubscriberBundle::~RawEventSubscriberBundle() { |
48 if (receiver_offset_estimator_.get()) { | 48 if (receiver_offset_estimator_.get()) { |
49 cast_environment_->Logging()->RemoveRawEventSubscriber( | 49 cast_environment_->Logging()->RemoveRawEventSubscriber( |
50 receiver_offset_estimator_.get()); | 50 receiver_offset_estimator_.get()); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 void RawEventSubscriberBundle::AddEventSubscribers(bool is_audio) { | 54 void RawEventSubscriberBundle::AddEventSubscribers(bool is_audio) { |
55 if (!receiver_offset_estimator_.get()) { | 55 if (!receiver_offset_estimator_.get()) { |
56 receiver_offset_estimator_.reset( | 56 receiver_offset_estimator_.reset( |
57 new ReceiverTimeOffsetEstimatorImpl); | 57 new ReceiverTimeOffsetEstimatorImpl(cast_environment_->Clock())); |
58 cast_environment_->Logging()->AddRawEventSubscriber( | 58 cast_environment_->Logging()->AddRawEventSubscriber( |
59 receiver_offset_estimator_.get()); | 59 receiver_offset_estimator_.get()); |
60 } | 60 } |
61 SubscribersMapByStream::iterator it = subscribers_.find(is_audio); | 61 SubscribersMapByStream::iterator it = subscribers_.find(is_audio); |
62 if (it != subscribers_.end()) | 62 if (it != subscribers_.end()) |
63 return; | 63 return; |
64 | 64 |
65 subscribers_.insert(std::make_pair( | 65 subscribers_.insert(std::make_pair( |
66 is_audio, | 66 is_audio, |
67 make_linked_ptr(new RawEventSubscriberBundleForStream( | 67 make_linked_ptr(new RawEventSubscriberBundleForStream( |
(...skipping 22 matching lines...) Expand all Loading... |
90 | 90 |
91 StatsEventSubscriber* | 91 StatsEventSubscriber* |
92 RawEventSubscriberBundle::GetStatsEventSubscriber(bool is_audio) { | 92 RawEventSubscriberBundle::GetStatsEventSubscriber(bool is_audio) { |
93 SubscribersMapByStream::iterator it = subscribers_.find(is_audio); | 93 SubscribersMapByStream::iterator it = subscribers_.find(is_audio); |
94 return it == subscribers_.end() ? | 94 return it == subscribers_.end() ? |
95 NULL : it->second->GetStatsEventSubscriber(); | 95 NULL : it->second->GetStatsEventSubscriber(); |
96 } | 96 } |
97 | 97 |
98 } // namespace cast | 98 } // namespace cast |
99 } // namespace media | 99 } // namespace media |
OLD | NEW |