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 "content/renderer/media/media_stream_video_source.h" | 5 #include "content/renderer/media/media_stream_video_source.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 static_cast<int>(MediaStreamVideoSource::kDefaultHeight)); | 291 static_cast<int>(MediaStreamVideoSource::kDefaultHeight)); |
292 | 292 |
293 return GetBestFormatBasedOnArea(formats, area); | 293 return GetBestFormatBasedOnArea(formats, area); |
294 } | 294 } |
295 | 295 |
296 } // anonymous namespace | 296 } // anonymous namespace |
297 | 297 |
298 // static | 298 // static |
299 MediaStreamVideoSource* MediaStreamVideoSource::GetVideoSource( | 299 MediaStreamVideoSource* MediaStreamVideoSource::GetVideoSource( |
300 const blink::WebMediaStreamSource& source) { | 300 const blink::WebMediaStreamSource& source) { |
| 301 if (source.isNull() || |
| 302 source.getType() != blink::WebMediaStreamSource::TypeVideo) { |
| 303 return nullptr; |
| 304 } |
301 return static_cast<MediaStreamVideoSource*>(source.getExtraData()); | 305 return static_cast<MediaStreamVideoSource*>(source.getExtraData()); |
302 } | 306 } |
303 | 307 |
304 // static, deprecated | 308 // static, deprecated |
305 bool MediaStreamVideoSource::IsConstraintSupported(const std::string& name) { | 309 bool MediaStreamVideoSource::IsConstraintSupported(const std::string& name) { |
306 return std::find(kSupportedConstraints, | 310 return std::find(kSupportedConstraints, |
307 kSupportedConstraints + arraysize(kSupportedConstraints), | 311 kSupportedConstraints + arraysize(kSupportedConstraints), |
308 name) != | 312 name) != |
309 kSupportedConstraints + arraysize(kSupportedConstraints); | 313 kSupportedConstraints + arraysize(kSupportedConstraints); |
310 } | 314 } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 callback(callback) { | 588 callback(callback) { |
585 } | 589 } |
586 | 590 |
587 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( | 591 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( |
588 const TrackDescriptor& other) = default; | 592 const TrackDescriptor& other) = default; |
589 | 593 |
590 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { | 594 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { |
591 } | 595 } |
592 | 596 |
593 } // namespace content | 597 } // namespace content |
OLD | NEW |