| 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 return true; | 493 return true; |
| 494 } | 494 } |
| 495 std::string unsatisfied_constraint; | 495 std::string unsatisfied_constraint; |
| 496 const media::VideoCaptureFormats filtered_formats = | 496 const media::VideoCaptureFormats filtered_formats = |
| 497 FilterFormats(track_constraints, formats, &unsatisfied_constraint); | 497 FilterFormats(track_constraints, formats, &unsatisfied_constraint); |
| 498 if (filtered_formats.empty()) | 498 if (filtered_formats.empty()) |
| 499 continue; | 499 continue; |
| 500 | 500 |
| 501 // A request with constraints that can be fulfilled. | 501 // A request with constraints that can be fulfilled. |
| 502 *fulfilled_constraints = track_constraints; | 502 *fulfilled_constraints = track_constraints; |
| 503 *best_format = GetBestCaptureFormat(filtered_formats, track_constraints); | 503 media::VideoCaptureFormat best_format_candidate = |
| 504 GetBestCaptureFormat(filtered_formats, track_constraints); |
| 505 if (!best_format_candidate.IsValid()) |
| 506 continue; |
| 507 |
| 508 *best_format = best_format_candidate; |
| 504 DVLOG(3) << "Found a track that matches the constraints"; | 509 DVLOG(3) << "Found a track that matches the constraints"; |
| 505 return true; | 510 return true; |
| 506 } | 511 } |
| 507 DVLOG(3) << "No usable format found"; | 512 DVLOG(3) << "No usable format found"; |
| 508 return false; | 513 return false; |
| 509 } | 514 } |
| 510 | 515 |
| 511 void MediaStreamVideoSource::OnStartDone(MediaStreamRequestResult result) { | 516 void MediaStreamVideoSource::OnStartDone(MediaStreamRequestResult result) { |
| 512 DCHECK(CalledOnValidThread()); | 517 DCHECK(CalledOnValidThread()); |
| 513 DVLOG(3) << "OnStartDone({result =" << result << "})"; | 518 DVLOG(3) << "OnStartDone({result =" << result << "})"; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 callback(callback) { | 615 callback(callback) { |
| 611 } | 616 } |
| 612 | 617 |
| 613 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( | 618 MediaStreamVideoSource::TrackDescriptor::TrackDescriptor( |
| 614 const TrackDescriptor& other) = default; | 619 const TrackDescriptor& other) = default; |
| 615 | 620 |
| 616 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { | 621 MediaStreamVideoSource::TrackDescriptor::~TrackDescriptor() { |
| 617 } | 622 } |
| 618 | 623 |
| 619 } // namespace content | 624 } // namespace content |
| OLD | NEW |