| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/user_media_client_impl.h" | 5 #include "content/renderer/media/user_media_client_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 RenderFrameObserver::routing_id(), device, audio_processing_properties, | 1003 RenderFrameObserver::routing_id(), device, audio_processing_properties, |
| 1004 source_ready, dependency_factory_); | 1004 source_ready, dependency_factory_); |
| 1005 return source; | 1005 return source; |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 MediaStreamVideoSource* UserMediaClientImpl::CreateVideoSource( | 1008 MediaStreamVideoSource* UserMediaClientImpl::CreateVideoSource( |
| 1009 const StreamDeviceInfo& device, | 1009 const StreamDeviceInfo& device, |
| 1010 const MediaStreamSource::SourceStoppedCallback& stop_callback) { | 1010 const MediaStreamSource::SourceStoppedCallback& stop_callback) { |
| 1011 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | 1011 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 1012 DCHECK(current_request_info_); | 1012 DCHECK(current_request_info_); |
| 1013 if (IsOldVideoConstraints()) { | |
| 1014 return new MediaStreamVideoCapturerSource(stop_callback, device, | |
| 1015 render_frame()); | |
| 1016 } | |
| 1017 | |
| 1018 DCHECK(current_request_info_->video_capture_settings().HasValue()); | 1013 DCHECK(current_request_info_->video_capture_settings().HasValue()); |
| 1019 return new MediaStreamVideoCapturerSource( | 1014 return new MediaStreamVideoCapturerSource( |
| 1020 stop_callback, device, | 1015 stop_callback, device, |
| 1021 current_request_info_->video_capture_settings().capture_params(), | 1016 current_request_info_->video_capture_settings().capture_params(), |
| 1022 render_frame()); | 1017 render_frame()); |
| 1023 } | 1018 } |
| 1024 | 1019 |
| 1025 void UserMediaClientImpl::CreateVideoTracks( | 1020 void UserMediaClientImpl::CreateVideoTracks( |
| 1026 const StreamDeviceInfoArray& devices, | 1021 const StreamDeviceInfoArray& devices, |
| 1027 blink::WebVector<blink::WebMediaStreamTrack>* webkit_tracks) { | 1022 blink::WebVector<blink::WebMediaStreamTrack>* webkit_tracks) { |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 UserMediaClientImpl::UserMediaRequestInfo::CreateAndStartVideoTrack( | 1472 UserMediaClientImpl::UserMediaRequestInfo::CreateAndStartVideoTrack( |
| 1478 const blink::WebMediaStreamSource& source) { | 1473 const blink::WebMediaStreamSource& source) { |
| 1479 DCHECK(source.GetType() == blink::WebMediaStreamSource::kTypeVideo); | 1474 DCHECK(source.GetType() == blink::WebMediaStreamSource::kTypeVideo); |
| 1480 DCHECK(request_.Video()); | 1475 DCHECK(request_.Video()); |
| 1481 DCHECK(video_capture_settings_.HasValue()); | 1476 DCHECK(video_capture_settings_.HasValue()); |
| 1482 MediaStreamVideoSource* native_source = | 1477 MediaStreamVideoSource* native_source = |
| 1483 MediaStreamVideoSource::GetVideoSource(source); | 1478 MediaStreamVideoSource::GetVideoSource(source); |
| 1484 DCHECK(native_source); | 1479 DCHECK(native_source); |
| 1485 sources_.push_back(source); | 1480 sources_.push_back(source); |
| 1486 sources_waiting_for_callback_.push_back(native_source); | 1481 sources_waiting_for_callback_.push_back(native_source); |
| 1487 if (IsOldVideoConstraints()) { | |
| 1488 return MediaStreamVideoTrack::CreateVideoTrack( | |
| 1489 native_source, request_.VideoConstraints(), | |
| 1490 base::Bind(&UserMediaClientImpl::UserMediaRequestInfo::OnTrackStarted, | |
| 1491 AsWeakPtr()), | |
| 1492 true); | |
| 1493 } | |
| 1494 return MediaStreamVideoTrack::CreateVideoTrack( | 1482 return MediaStreamVideoTrack::CreateVideoTrack( |
| 1495 native_source, video_capture_settings_.track_adapter_settings(), | 1483 native_source, video_capture_settings_.track_adapter_settings(), |
| 1496 video_capture_settings_.noise_reduction(), is_video_content_capture_, | 1484 video_capture_settings_.noise_reduction(), is_video_content_capture_, |
| 1497 video_capture_settings_.min_frame_rate(), | 1485 video_capture_settings_.min_frame_rate(), |
| 1498 base::Bind(&UserMediaClientImpl::UserMediaRequestInfo::OnTrackStarted, | 1486 base::Bind(&UserMediaClientImpl::UserMediaRequestInfo::OnTrackStarted, |
| 1499 AsWeakPtr()), | 1487 AsWeakPtr()), |
| 1500 true); | 1488 true); |
| 1501 } | 1489 } |
| 1502 | 1490 |
| 1503 void UserMediaClientImpl::UserMediaRequestInfo::CallbackOnTracksStarted( | 1491 void UserMediaClientImpl::UserMediaRequestInfo::CallbackOnTracksStarted( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 const blink::WebString& result_name) { | 1533 const blink::WebString& result_name) { |
| 1546 // Check if we're waiting to be notified of this source. If not, then we'll | 1534 // Check if we're waiting to be notified of this source. If not, then we'll |
| 1547 // ignore the notification. | 1535 // ignore the notification. |
| 1548 auto found = std::find(sources_waiting_for_callback_.begin(), | 1536 auto found = std::find(sources_waiting_for_callback_.begin(), |
| 1549 sources_waiting_for_callback_.end(), source); | 1537 sources_waiting_for_callback_.end(), source); |
| 1550 if (found != sources_waiting_for_callback_.end()) | 1538 if (found != sources_waiting_for_callback_.end()) |
| 1551 OnTrackStarted(source, result, result_name); | 1539 OnTrackStarted(source, result, result_name); |
| 1552 } | 1540 } |
| 1553 | 1541 |
| 1554 } // namespace content | 1542 } // namespace content |
| OLD | NEW |