| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/remoting/remoting_source_impl.h" | 5 #include "media/remoting/remoting_source_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "media/remoting/rpc/proto_utils.h" | 9 #include "media/remoting/rpc/proto_utils.h" |
| 10 | 10 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 remoter_->Stop(mojom::RemotingStopReason::LOCAL_PLAYBACK); | 154 remoter_->Stop(mojom::RemotingStopReason::LOCAL_PLAYBACK); |
| 155 UpdateAndNotifyState(RemotingSessionState::SESSION_STOPPING); | 155 UpdateAndNotifyState(RemotingSessionState::SESSION_STOPPING); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void RemotingSourceImpl::AddClient(Client* client) { | 158 void RemotingSourceImpl::AddClient(Client* client) { |
| 159 DCHECK(thread_checker_.CalledOnValidThread()); | 159 DCHECK(thread_checker_.CalledOnValidThread()); |
| 160 DCHECK(std::find(clients_.begin(), clients_.end(), client) == clients_.end()); | 160 DCHECK(std::find(clients_.begin(), clients_.end(), client) == clients_.end()); |
| 161 | 161 |
| 162 clients_.push_back(client); | 162 clients_.push_back(client); |
| 163 client->OnSessionStateChanged(); | |
| 164 } | 163 } |
| 165 | 164 |
| 166 void RemotingSourceImpl::RemoveClient(Client* client) { | 165 void RemotingSourceImpl::RemoveClient(Client* client) { |
| 167 DCHECK(thread_checker_.CalledOnValidThread()); | 166 DCHECK(thread_checker_.CalledOnValidThread()); |
| 168 | 167 |
| 169 auto it = std::find(clients_.begin(), clients_.end(), client); | 168 auto it = std::find(clients_.begin(), clients_.end(), client); |
| 170 DCHECK(it != clients_.end()); | 169 DCHECK(it != clients_.end()); |
| 171 | 170 |
| 172 clients_.erase(it); | 171 clients_.erase(it); |
| 173 if (clients_.empty() && (state_ == RemotingSessionState::SESSION_STARTED || | 172 if (clients_.empty() && (state_ == RemotingSessionState::SESSION_STARTED || |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 return const_cast<remoting::RpcBroker*>(&rpc_broker_); | 227 return const_cast<remoting::RpcBroker*>(&rpc_broker_); |
| 229 } | 228 } |
| 230 | 229 |
| 231 void RemotingSourceImpl::SendMessageToSink( | 230 void RemotingSourceImpl::SendMessageToSink( |
| 232 std::unique_ptr<std::vector<uint8_t>> message) { | 231 std::unique_ptr<std::vector<uint8_t>> message) { |
| 233 DCHECK(thread_checker_.CalledOnValidThread()); | 232 DCHECK(thread_checker_.CalledOnValidThread()); |
| 234 remoter_->SendMessageToSink(*message); | 233 remoter_->SendMessageToSink(*message); |
| 235 } | 234 } |
| 236 | 235 |
| 237 } // namespace media | 236 } // namespace media |
| OLD | NEW |