| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 // Note - the code below will potentially pick min and max from different | 100 // Note - the code below will potentially pick min and max from different |
| 101 // constraint sets, some of which might have been ignored. | 101 // constraint sets, some of which might have been ignored. |
| 102 for (const auto& constraint_set : constraints.advanced()) { | 102 for (const auto& constraint_set : constraints.advanced()) { |
| 103 if (constraint_set.aspectRatio.hasMin()) { | 103 if (constraint_set.aspectRatio.hasMin()) { |
| 104 *min_aspect_ratio = constraint_set.aspectRatio.min(); | 104 *min_aspect_ratio = constraint_set.aspectRatio.min(); |
| 105 break; | 105 break; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 for (const auto& constraint_set : constraints.advanced()) { | 108 for (const auto& constraint_set : constraints.advanced()) { |
| 109 if (constraint_set.aspectRatio.hasMax()) { | 109 // Advanced constraint sets with max aspect ratio 0 are unsatisfiable and |
| 110 // must be ignored. |
| 111 if (constraint_set.aspectRatio.hasMax() && |
| 112 constraint_set.aspectRatio.max() > 0) { |
| 110 *max_aspect_ratio = constraint_set.aspectRatio.max(); | 113 *max_aspect_ratio = constraint_set.aspectRatio.max(); |
| 111 break; | 114 break; |
| 112 } | 115 } |
| 113 } | 116 } |
| 114 } | 117 } |
| 115 | 118 |
| 116 // Returns true if |constraints| are fulfilled. |format| can be changed by a | 119 // Returns true if |constraints| are fulfilled. |format| can be changed by a |
| 117 // constraint, e.g. the frame rate can be changed by setting maxFrameRate. | 120 // constraint, e.g. the frame rate can be changed by setting maxFrameRate. |
| 118 bool UpdateFormatForConstraints( | 121 bool UpdateFormatForConstraints( |
| 119 const blink::WebMediaTrackConstraintSet& constraints, | 122 const blink::WebMediaTrackConstraintSet& constraints, |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 callback(callback) { | 618 callback(callback) { |
| 616 } | 619 } |
| 617 | 620 |
| 618 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( | 621 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( |
| 619 const TrackDescriptor& other) = default; | 622 const TrackDescriptor& other) = default; |
| 620 | 623 |
| 621 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { | 624 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { |
| 622 } | 625 } |
| 623 | 626 |
| 624 } // namespace content | 627 } // namespace content |
| OLD | NEW |