| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 &max_aspect_ratio); | 637 &max_aspect_ratio); |
| 638 double max_frame_rate = 0.0f; | 638 double max_frame_rate = 0.0f; |
| 639 // Note: Optional and ideal constraints are ignored; this is | 639 // Note: Optional and ideal constraints are ignored; this is |
| 640 // purely a hard max limit. | 640 // purely a hard max limit. |
| 641 if (track.constraints.Basic().frame_rate.HasMax()) | 641 if (track.constraints.Basic().frame_rate.HasMax()) |
| 642 max_frame_rate = track.constraints.Basic().frame_rate.Max(); | 642 max_frame_rate = track.constraints.Basic().frame_rate.Max(); |
| 643 | 643 |
| 644 track_adapter_->AddTrack( | 644 track_adapter_->AddTrack( |
| 645 track.track, track.frame_callback, | 645 track.track, track.frame_callback, |
| 646 VideoTrackAdapterSettings(max_width, max_height, min_aspect_ratio, | 646 VideoTrackAdapterSettings(max_width, max_height, min_aspect_ratio, |
| 647 max_aspect_ratio, max_frame_rate)); | 647 max_aspect_ratio, max_frame_rate, |
| 648 base::Optional<gfx::Size>())); |
| 648 // Calculate resulting frame size if the source delivers frames | 649 // Calculate resulting frame size if the source delivers frames |
| 649 // according to the current format. Note: Format may change later. | 650 // according to the current format. Note: Format may change later. |
| 650 gfx::Size desired_size; | 651 gfx::Size desired_size; |
| 651 VideoTrackAdapter::CalculateTargetSize( | 652 VideoTrackAdapter::CalculateTargetSize( |
| 652 current_format_.frame_size, gfx::Size(max_width, max_height), | 653 false /* is_rotated */, current_format_.frame_size, |
| 653 min_aspect_ratio, max_aspect_ratio, &desired_size); | 654 gfx::Size(max_width, max_height), min_aspect_ratio, max_aspect_ratio, |
| 655 &desired_size); |
| 654 track.track->SetTargetSizeAndFrameRate( | 656 track.track->SetTargetSizeAndFrameRate( |
| 655 desired_size.width(), desired_size.height(), max_frame_rate); | 657 desired_size.width(), desired_size.height(), max_frame_rate); |
| 656 } | 658 } |
| 657 | 659 |
| 658 DVLOG(3) << "FinalizeAddTrackLegacy() result " << result; | 660 DVLOG(3) << "FinalizeAddTrackLegacy() result " << result; |
| 659 | 661 |
| 660 if (!track.callback.is_null()) | 662 if (!track.callback.is_null()) |
| 661 track.callback.Run(this, result, | 663 track.callback.Run(this, result, |
| 662 blink::WebString::FromUTF8(unsatisfied_constraint)); | 664 blink::WebString::FromUTF8(unsatisfied_constraint)); |
| 663 } | 665 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 674 result = MEDIA_DEVICE_TRACK_START_FAILURE; | 676 result = MEDIA_DEVICE_TRACK_START_FAILURE; |
| 675 | 677 |
| 676 if (result == MEDIA_DEVICE_OK) { | 678 if (result == MEDIA_DEVICE_OK) { |
| 677 track_adapter_->AddTrack(track.track, track.frame_callback, | 679 track_adapter_->AddTrack(track.track, track.frame_callback, |
| 678 *track.adapter_settings); | 680 *track.adapter_settings); |
| 679 | 681 |
| 680 // Calculate resulting frame size if the source delivers frames | 682 // Calculate resulting frame size if the source delivers frames |
| 681 // according to the current format. Note: Format may change later. | 683 // according to the current format. Note: Format may change later. |
| 682 gfx::Size desired_size; | 684 gfx::Size desired_size; |
| 683 VideoTrackAdapter::CalculateTargetSize( | 685 VideoTrackAdapter::CalculateTargetSize( |
| 686 false /* is_rotated */, |
| 684 GetCurrentFormat() ? GetCurrentFormat()->frame_size | 687 GetCurrentFormat() ? GetCurrentFormat()->frame_size |
| 685 : gfx::Size(track.adapter_settings->max_width, | 688 : gfx::Size(track.adapter_settings->max_width, |
| 686 track.adapter_settings->max_height), | 689 track.adapter_settings->max_height), |
| 687 gfx::Size(track.adapter_settings->max_width, | 690 gfx::Size(track.adapter_settings->max_width, |
| 688 track.adapter_settings->max_height), | 691 track.adapter_settings->max_height), |
| 689 track.adapter_settings->min_aspect_ratio, | 692 track.adapter_settings->min_aspect_ratio, |
| 690 track.adapter_settings->max_aspect_ratio, &desired_size); | 693 track.adapter_settings->max_aspect_ratio, &desired_size); |
| 691 track.track->SetTargetSizeAndFrameRate( | 694 track.track->SetTargetSizeAndFrameRate( |
| 692 desired_size.width(), desired_size.height(), | 695 desired_size.width(), desired_size.height(), |
| 693 track.adapter_settings->max_frame_rate); | 696 track.adapter_settings->max_frame_rate); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( | 748 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( |
| 746 TrackDescriptor&& other) = default; | 749 TrackDescriptor&& other) = default; |
| 747 MediaStreamVideoSource::TrackDescriptor& | 750 MediaStreamVideoSource::TrackDescriptor& |
| 748 MediaStreamVideoSource::TrackDescriptor::operator=( | 751 MediaStreamVideoSource::TrackDescriptor::operator=( |
| 749 MediaStreamVideoSource::TrackDescriptor&& other) = default; | 752 MediaStreamVideoSource::TrackDescriptor&& other) = default; |
| 750 | 753 |
| 751 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { | 754 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { |
| 752 } | 755 } |
| 753 | 756 |
| 754 } // namespace content | 757 } // namespace content |
| OLD | NEW |