OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/renderer/media/peer_connection_tracker.h" | 4 #include "content/renderer/media/peer_connection_tracker.h" |
5 | 5 |
6 #include <stddef.h> | 6 #include <stddef.h> |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 if (id == -1) | 700 if (id == -1) |
701 return; | 701 return; |
702 SendPeerConnectionUpdate(id, "createDTMFSender", | 702 SendPeerConnectionUpdate(id, "createDTMFSender", |
703 base::UTF16ToUTF8(base::StringPiece16(track.id()))); | 703 base::UTF16ToUTF8(base::StringPiece16(track.id()))); |
704 } | 704 } |
705 | 705 |
706 void PeerConnectionTracker::TrackGetUserMedia( | 706 void PeerConnectionTracker::TrackGetUserMedia( |
707 const blink::WebUserMediaRequest& user_media_request) { | 707 const blink::WebUserMediaRequest& user_media_request) { |
708 DCHECK(main_thread_.CalledOnValidThread()); | 708 DCHECK(main_thread_.CalledOnValidThread()); |
709 | 709 |
| 710 std::string video_stream_source; |
| 711 if (!user_media_request.videoConstraints().isNull()) { |
| 712 const blink::WebMediaTrackConstraintSet& video_basic = |
| 713 user_media_request.videoConstraints().basic(); |
| 714 if (!video_basic.mediaStreamSource.exact().isEmpty()) |
| 715 video_stream_source = video_basic.mediaStreamSource.exact()[0].utf8(); |
| 716 } |
| 717 |
| 718 VideoInfo video_info; |
| 719 video_info.video = user_media_request.video(); |
| 720 video_info.video_stream_source = video_stream_source; |
710 SendTarget()->Send(new PeerConnectionTrackerHost_GetUserMedia( | 721 SendTarget()->Send(new PeerConnectionTrackerHost_GetUserMedia( |
711 user_media_request.getSecurityOrigin().toString().utf8(), | 722 user_media_request.getSecurityOrigin().toString().utf8(), |
712 user_media_request.audio(), user_media_request.video(), | 723 user_media_request.audio(), video_info, |
713 SerializeMediaConstraints(user_media_request.audioConstraints()), | 724 SerializeMediaConstraints(user_media_request.audioConstraints()), |
714 SerializeMediaConstraints(user_media_request.videoConstraints()))); | 725 SerializeMediaConstraints(user_media_request.videoConstraints()))); |
715 } | 726 } |
716 | 727 |
717 int PeerConnectionTracker::GetNextLocalID() { | 728 int PeerConnectionTracker::GetNextLocalID() { |
718 DCHECK(main_thread_.CalledOnValidThread()); | 729 DCHECK(main_thread_.CalledOnValidThread()); |
719 if (next_local_id_< 0) | 730 if (next_local_id_< 0) |
720 next_local_id_ = 1; | 731 next_local_id_ = 1; |
721 return next_local_id_++; | 732 return next_local_id_++; |
722 } | 733 } |
(...skipping 15 matching lines...) Expand all Loading... |
738 DCHECK(main_thread_.CalledOnValidThread()); | 749 DCHECK(main_thread_.CalledOnValidThread()); |
739 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection( | 750 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection( |
740 local_id, std::string(callback_type), value)); | 751 local_id, std::string(callback_type), value)); |
741 } | 752 } |
742 | 753 |
743 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) { | 754 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) { |
744 send_target_for_test_ = target; | 755 send_target_for_test_ = target; |
745 } | 756 } |
746 | 757 |
747 } // namespace content | 758 } // namespace content |
OLD | NEW |