| 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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 &max_aspect_ratio); | 575 &max_aspect_ratio); |
| 576 double max_frame_rate = 0.0f; | 576 double max_frame_rate = 0.0f; |
| 577 // Note: Optional and ideal constraints are ignored; this is | 577 // Note: Optional and ideal constraints are ignored; this is |
| 578 // purely a hard max limit. | 578 // purely a hard max limit. |
| 579 if (track.constraints.basic().frameRate.hasMax()) | 579 if (track.constraints.basic().frameRate.hasMax()) |
| 580 max_frame_rate = track.constraints.basic().frameRate.max(); | 580 max_frame_rate = track.constraints.basic().frameRate.max(); |
| 581 | 581 |
| 582 track_adapter_->AddTrack(track.track, track.frame_callback, max_width, | 582 track_adapter_->AddTrack(track.track, track.frame_callback, max_width, |
| 583 max_height, min_aspect_ratio, max_aspect_ratio, | 583 max_height, min_aspect_ratio, max_aspect_ratio, |
| 584 max_frame_rate); | 584 max_frame_rate); |
| 585 // Calculate resulting frame size if the source delivers frames |
| 586 // according to the current format. Note: Format may change later. |
| 587 gfx::Size desired_size; |
| 588 VideoTrackAdapter::CalculateTargetSize( |
| 589 current_format_.frame_size, gfx::Size(max_width, max_height), |
| 590 min_aspect_ratio, max_aspect_ratio, &desired_size); |
| 591 track.track->SetTargetSize(desired_size.width(), desired_size.height()); |
| 585 } | 592 } |
| 586 | 593 |
| 587 DVLOG(3) << "FinalizeAddTrack() result " << result; | 594 DVLOG(3) << "FinalizeAddTrack() result " << result; |
| 588 | 595 |
| 589 if (!track.callback.is_null()) | 596 if (!track.callback.is_null()) |
| 590 track.callback.Run(this, result, | 597 track.callback.Run(this, result, |
| 591 blink::WebString::fromUTF8(unsatisfied_constraint)); | 598 blink::WebString::fromUTF8(unsatisfied_constraint)); |
| 592 } | 599 } |
| 593 } | 600 } |
| 594 | 601 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 623 callback(callback) { | 630 callback(callback) { |
| 624 } | 631 } |
| 625 | 632 |
| 626 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( | 633 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( |
| 627 const TrackDescriptor& other) = default; | 634 const TrackDescriptor& other) = default; |
| 628 | 635 |
| 629 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { | 636 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { |
| 630 } | 637 } |
| 631 | 638 |
| 632 } // namespace content | 639 } // namespace content |
| OLD | NEW |