| 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_impl.h" | 5 #include "content/renderer/media/media_stream_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 DeleteUserMediaRequestInfo(request); | 195 DeleteUserMediaRequestInfo(request); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 WebKit::WebMediaStream MediaStreamImpl::GetMediaStream( | 199 WebKit::WebMediaStream MediaStreamImpl::GetMediaStream( |
| 200 const GURL& url) { | 200 const GURL& url) { |
| 201 return WebKit::WebMediaStreamRegistry::lookupMediaStreamDescriptor(url); | 201 return WebKit::WebMediaStreamRegistry::lookupMediaStreamDescriptor(url); |
| 202 } | 202 } |
| 203 | 203 |
| 204 bool MediaStreamImpl::IsMediaStream(const GURL& url) { | 204 bool MediaStreamImpl::IsMediaStream(const GURL& url) { |
| 205 return CheckMediaStream(url); | |
| 206 } | |
| 207 | |
| 208 // static | |
| 209 bool MediaStreamImpl::CheckMediaStream(const GURL& url) { | |
| 210 WebKit::WebMediaStream descriptor( | 205 WebKit::WebMediaStream descriptor( |
| 211 WebKit::WebMediaStreamRegistry::lookupMediaStreamDescriptor(url)); | 206 WebKit::WebMediaStreamRegistry::lookupMediaStreamDescriptor(url)); |
| 212 | 207 |
| 213 if (descriptor.isNull() || !descriptor.extraData()) | 208 if (descriptor.isNull() || !descriptor.extraData()) |
| 214 return false; // This is not a valid stream. | 209 return false; // This is not a valid stream. |
| 215 | 210 |
| 216 webrtc::MediaStreamInterface* stream = GetNativeMediaStream(descriptor); | 211 webrtc::MediaStreamInterface* stream = GetNativeMediaStream(descriptor); |
| 217 return (stream && | 212 return (stream && |
| 218 (!stream->GetVideoTracks().empty() || !stream->GetAudioTracks().empty())); | 213 (!stream->GetVideoTracks().empty() || !stream->GetAudioTracks().empty())); |
| 219 } | 214 } |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 } | 617 } |
| 623 | 618 |
| 624 for (size_t i = 0; i < video_sources.size(); ++i) { | 619 for (size_t i = 0; i < video_sources.size(); ++i) { |
| 625 video_sources[i].setReadyState( | 620 video_sources[i].setReadyState( |
| 626 WebKit::WebMediaStreamSource::ReadyStateEnded); | 621 WebKit::WebMediaStreamSource::ReadyStateEnded); |
| 627 video_sources[i].setExtraData(NULL); | 622 video_sources[i].setExtraData(NULL); |
| 628 } | 623 } |
| 629 } | 624 } |
| 630 | 625 |
| 631 } // namespace content | 626 } // namespace content |
| OLD | NEW |