| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/media/media_stream_dispatcher.h" | 5 #include "content/renderer/media/media_stream_dispatcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/common/media/media_stream_messages.h" | 10 #include "content/common/media/media_stream_messages.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 << ", {label = " << label << "}"; | 161 << ", {label = " << label << "}"; |
| 162 | 162 |
| 163 LabelStreamMap::iterator it = label_stream_map_.find(label); | 163 LabelStreamMap::iterator it = label_stream_map_.find(label); |
| 164 if (it == label_stream_map_.end()) | 164 if (it == label_stream_map_.end()) |
| 165 return; | 165 return; |
| 166 label_stream_map_.erase(it); | 166 label_stream_map_.erase(it); |
| 167 | 167 |
| 168 Send(new MediaStreamHostMsg_CloseDevice(routing_id(), label)); | 168 Send(new MediaStreamHostMsg_CloseDevice(routing_id(), label)); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void MediaStreamDispatcher::OnStreamStarted(const std::string& label) { |
| 172 DCHECK(thread_checker_.CalledOnValidThread()); |
| 173 DVLOG(1) << "MediaStreamDispatcher::OnStreamStarted(" << label << ")"; |
| 174 |
| 175 Send(new MediaStreamHostMsg_StreamStarted(label)); |
| 176 } |
| 177 |
| 171 void MediaStreamDispatcher::OnDestruct() { | 178 void MediaStreamDispatcher::OnDestruct() { |
| 172 // Do not self-destruct. UserMediaClientImpl owns |this|. | 179 // Do not self-destruct. UserMediaClientImpl owns |this|. |
| 173 } | 180 } |
| 174 | 181 |
| 175 bool MediaStreamDispatcher::Send(IPC::Message* message) { | 182 bool MediaStreamDispatcher::Send(IPC::Message* message) { |
| 176 if (!RenderThread::Get()) { | 183 if (!RenderThread::Get()) { |
| 177 delete message; | 184 delete message; |
| 178 return false; | 185 return false; |
| 179 } | 186 } |
| 180 | 187 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 DCHECK(thread_checker_.CalledOnValidThread()); | 357 DCHECK(thread_checker_.CalledOnValidThread()); |
| 351 LabelStreamMap::iterator it = label_stream_map_.find(label); | 358 LabelStreamMap::iterator it = label_stream_map_.find(label); |
| 352 if (it == label_stream_map_.end() || | 359 if (it == label_stream_map_.end() || |
| 353 it->second.video_array.size() <= static_cast<size_t>(index)) { | 360 it->second.video_array.size() <= static_cast<size_t>(index)) { |
| 354 return StreamDeviceInfo::kNoId; | 361 return StreamDeviceInfo::kNoId; |
| 355 } | 362 } |
| 356 return it->second.video_array[index].session_id; | 363 return it->second.video_array[index].session_id; |
| 357 } | 364 } |
| 358 | 365 |
| 359 } // namespace content | 366 } // namespace content |
| OLD | NEW |