Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(932)

Side by Side Diff: content/renderer/media/media_stream_video_source.cc

Issue 2777703002: Introduce SelectSettings algorithm for MediaStream video tracks. (Closed)
Patch Set: static asserts Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 double min_aspect_ratio; 572 double min_aspect_ratio;
573 GetDesiredMinAndMaxAspectRatio(track.constraints, 573 GetDesiredMinAndMaxAspectRatio(track.constraints,
574 &min_aspect_ratio, 574 &min_aspect_ratio,
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(
583 max_height, min_aspect_ratio, max_aspect_ratio, 583 track.track, track.frame_callback,
584 max_frame_rate); 584 VideoTrackAdapterSettings(max_width, max_height, min_aspect_ratio,
585 max_aspect_ratio, max_frame_rate));
585 // Calculate resulting frame size if the source delivers frames 586 // Calculate resulting frame size if the source delivers frames
586 // according to the current format. Note: Format may change later. 587 // according to the current format. Note: Format may change later.
587 gfx::Size desired_size; 588 gfx::Size desired_size;
588 VideoTrackAdapter::CalculateTargetSize( 589 VideoTrackAdapter::CalculateTargetSize(
589 current_format_.frame_size, gfx::Size(max_width, max_height), 590 current_format_.frame_size, gfx::Size(max_width, max_height),
590 min_aspect_ratio, max_aspect_ratio, &desired_size); 591 min_aspect_ratio, max_aspect_ratio, &desired_size);
591 track.track->SetTargetSize(desired_size.width(), desired_size.height()); 592 track.track->SetTargetSize(desired_size.width(), desired_size.height());
592 } 593 }
593 594
594 DVLOG(3) << "FinalizeAddTrack() result " << result; 595 DVLOG(3) << "FinalizeAddTrack() result " << result;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 callback(callback) { 631 callback(callback) {
631 } 632 }
632 633
633 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( 634 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor(
634 const TrackDescriptor& other) = default; 635 const TrackDescriptor& other) = default;
635 636
636 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { 637 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() {
637 } 638 }
638 639
639 } // namespace content 640 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698