| 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 11 matching lines...) Expand all Loading... |
| 22 const char MediaStreamVideoSource::kMinAspectRatio[] = "minAspectRatio"; | 22 const char MediaStreamVideoSource::kMinAspectRatio[] = "minAspectRatio"; |
| 23 const char MediaStreamVideoSource::kMaxAspectRatio[] = "maxAspectRatio"; | 23 const char MediaStreamVideoSource::kMaxAspectRatio[] = "maxAspectRatio"; |
| 24 const char MediaStreamVideoSource::kMaxWidth[] = "maxWidth"; | 24 const char MediaStreamVideoSource::kMaxWidth[] = "maxWidth"; |
| 25 const char MediaStreamVideoSource::kMinWidth[] = "minWidth"; | 25 const char MediaStreamVideoSource::kMinWidth[] = "minWidth"; |
| 26 const char MediaStreamVideoSource::kMaxHeight[] = "maxHeight"; | 26 const char MediaStreamVideoSource::kMaxHeight[] = "maxHeight"; |
| 27 const char MediaStreamVideoSource::kMinHeight[] = "minHeight"; | 27 const char MediaStreamVideoSource::kMinHeight[] = "minHeight"; |
| 28 const char MediaStreamVideoSource::kMaxFrameRate[] = "maxFrameRate"; | 28 const char MediaStreamVideoSource::kMaxFrameRate[] = "maxFrameRate"; |
| 29 const char MediaStreamVideoSource::kMinFrameRate[] = "minFrameRate"; | 29 const char MediaStreamVideoSource::kMinFrameRate[] = "minFrameRate"; |
| 30 | 30 |
| 31 // TODO(mcasas): Find a way to guarantee all constraints are added to the array. | 31 // TODO(mcasas): Find a way to guarantee all constraints are added to the array. |
| 32 const char* kSupportedConstraints[] = { | 32 const char* const kSupportedConstraints[] = { |
| 33 MediaStreamVideoSource::kMaxAspectRatio, | 33 MediaStreamVideoSource::kMaxAspectRatio, |
| 34 MediaStreamVideoSource::kMinAspectRatio, | 34 MediaStreamVideoSource::kMinAspectRatio, |
| 35 MediaStreamVideoSource::kMaxWidth, | 35 MediaStreamVideoSource::kMaxWidth, |
| 36 MediaStreamVideoSource::kMinWidth, | 36 MediaStreamVideoSource::kMinWidth, |
| 37 MediaStreamVideoSource::kMaxHeight, | 37 MediaStreamVideoSource::kMaxHeight, |
| 38 MediaStreamVideoSource::kMinHeight, | 38 MediaStreamVideoSource::kMinHeight, |
| 39 MediaStreamVideoSource::kMaxFrameRate, | 39 MediaStreamVideoSource::kMaxFrameRate, |
| 40 MediaStreamVideoSource::kMinFrameRate, | 40 MediaStreamVideoSource::kMinFrameRate, |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 const char* kLegalVideoConstraints[] = { | 45 const char* const kLegalVideoConstraints[] = { |
| 46 "width", "height", "aspectRatio", "frameRate", | 46 "width", "height", "aspectRatio", "frameRate", |
| 47 "facingMode", "deviceId", "groupId", "mediaStreamSource", | 47 "facingMode", "deviceId", "groupId", "mediaStreamSource", |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 // Returns true if |constraint| has mandatory constraints. | 50 // Returns true if |constraint| has mandatory constraints. |
| 51 bool HasMandatoryConstraints(const blink::WebMediaConstraints& constraints) { | 51 bool HasMandatoryConstraints(const blink::WebMediaConstraints& constraints) { |
| 52 return constraints.basic().hasMandatory(); | 52 return constraints.basic().hasMandatory(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Retrieve the desired max width and height from |constraints|. If not set, | 55 // Retrieve the desired max width and height from |constraints|. If not set, |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 callback(callback) { | 588 callback(callback) { |
| 589 } | 589 } |
| 590 | 590 |
| 591 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( | 591 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( |
| 592 const TrackDescriptor& other) = default; | 592 const TrackDescriptor& other) = default; |
| 593 | 593 |
| 594 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { | 594 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { |
| 595 } | 595 } |
| 596 | 596 |
| 597 } // namespace content | 597 } // namespace content |
| OLD | NEW |