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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
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(new ReceiverTimeOffsetEstimatorImpl); |
57 new ReceiverTimeOffsetEstimatorImpl(cast_environment_->Clock())); | |
58 cast_environment_->Logging()->AddRawEventSubscriber( | 57 cast_environment_->Logging()->AddRawEventSubscriber( |
59 receiver_offset_estimator_.get()); | 58 receiver_offset_estimator_.get()); |
60 } | 59 } |
61 SubscribersMapByStream::iterator it = subscribers_.find(is_audio); | 60 SubscribersMapByStream::iterator it = subscribers_.find(is_audio); |
62 if (it != subscribers_.end()) | 61 if (it != subscribers_.end()) |
63 return; | 62 return; |
64 | 63 |
65 subscribers_.insert(std::make_pair( | 64 subscribers_.insert(std::make_pair( |
66 is_audio, | 65 is_audio, |
67 make_linked_ptr(new RawEventSubscriberBundleForStream( | 66 make_linked_ptr(new RawEventSubscriberBundleForStream( |
(...skipping 22 matching lines...) Expand all Loading... |
90 | 89 |
91 StatsEventSubscriber* | 90 StatsEventSubscriber* |
92 RawEventSubscriberBundle::GetStatsEventSubscriber(bool is_audio) { | 91 RawEventSubscriberBundle::GetStatsEventSubscriber(bool is_audio) { |
93 SubscribersMapByStream::iterator it = subscribers_.find(is_audio); | 92 SubscribersMapByStream::iterator it = subscribers_.find(is_audio); |
94 return it == subscribers_.end() ? | 93 return it == subscribers_.end() ? |
95 NULL : it->second->GetStatsEventSubscriber(); | 94 NULL : it->second->GetStatsEventSubscriber(); |
96 } | 95 } |
97 | 96 |
98 } // namespace cast | 97 } // namespace cast |
99 } // namespace media | 98 } // namespace media |
OLD | NEW |