Chromium Code Reviews| 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/rtc_peer_connection_handler.h" | 5 #include "content/renderer/media/rtc_peer_connection_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 17 #include "content/renderer/media/media_stream_dependency_factory.h" | 17 #include "content/renderer/media/media_stream_dependency_factory.h" |
| 18 #include "content/renderer/media/peer_connection_tracker.h" | 18 #include "content/renderer/media/peer_connection_tracker.h" |
| 19 #include "content/renderer/media/remote_media_stream_impl.h" | 19 #include "content/renderer/media/remote_media_stream_impl.h" |
| 20 #include "content/renderer/media/rtc_data_channel_handler.h" | 20 #include "content/renderer/media/rtc_data_channel_handler.h" |
| 21 #include "content/renderer/media/rtc_dtmf_sender_handler.h" | 21 #include "content/renderer/media/rtc_dtmf_sender_handler.h" |
| 22 #include "content/renderer/media/rtc_media_constraints.h" | 22 #include "content/renderer/media/rtc_media_constraints.h" |
| 23 #include "content/renderer/media/webrtc_audio_capturer.h" | |
| 24 #include "content/renderer/media/webrtc_audio_device_impl.h" | |
| 23 #include "content/renderer/render_thread_impl.h" | 25 #include "content/renderer/render_thread_impl.h" |
| 24 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 26 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 25 // TODO(hta): Move the following include to WebRTCStatsRequest.h file. | 27 // TODO(hta): Move the following include to WebRTCStatsRequest.h file. |
| 26 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 28 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| 27 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 29 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 28 #include "third_party/WebKit/public/platform/WebRTCConfiguration.h" | 30 #include "third_party/WebKit/public/platform/WebRTCConfiguration.h" |
| 29 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h" | 31 #include "third_party/WebKit/public/platform/WebRTCDataChannelInit.h" |
| 30 #include "third_party/WebKit/public/platform/WebRTCICECandidate.h" | 32 #include "third_party/WebKit/public/platform/WebRTCICECandidate.h" |
| 31 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandlerClient.h " | 33 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandlerClient.h " |
| 32 #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h" | 34 #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h" |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 523 } | 525 } |
| 524 | 526 |
| 525 bool RTCPeerConnectionHandler::addStream( | 527 bool RTCPeerConnectionHandler::addStream( |
| 526 const WebKit::WebMediaStream& stream, | 528 const WebKit::WebMediaStream& stream, |
| 527 const WebKit::WebMediaConstraints& options) { | 529 const WebKit::WebMediaConstraints& options) { |
| 528 RTCMediaConstraints constraints(options); | 530 RTCMediaConstraints constraints(options); |
| 529 | 531 |
| 530 if (peer_connection_tracker_) | 532 if (peer_connection_tracker_) |
| 531 peer_connection_tracker_->TrackAddStream( | 533 peer_connection_tracker_->TrackAddStream( |
| 532 this, stream, PeerConnectionTracker::SOURCE_LOCAL); | 534 this, stream, PeerConnectionTracker::SOURCE_LOCAL); |
| 535 | |
| 536 // A media stream is connected to a peer connection, enable the native mode | |
|
tommi (sloooow) - chröme
2013/09/06 11:20:30
s/the native mode/peer connection mode
no longer working on chromium
2013/09/10 12:43:15
Done.
| |
| 537 // for the capturer. | |
| 538 WebRtcAudioDeviceImpl* audio_device = | |
| 539 dependency_factory_->GetWebRtcAudioDevice(); | |
| 540 if (audio_device) { | |
| 541 WebRtcAudioCapturer* capturer = audio_device->GetDefaultCapturer(); | |
| 542 if (capturer) | |
| 543 capturer->EnablePeerConnectionMode(); | |
| 544 } | |
| 545 | |
| 533 return AddStream(stream, &constraints); | 546 return AddStream(stream, &constraints); |
| 534 } | 547 } |
| 535 | 548 |
| 536 void RTCPeerConnectionHandler::removeStream( | 549 void RTCPeerConnectionHandler::removeStream( |
| 537 const WebKit::WebMediaStream& stream) { | 550 const WebKit::WebMediaStream& stream) { |
| 538 RemoveStream(stream); | 551 RemoveStream(stream); |
| 539 if (peer_connection_tracker_) | 552 if (peer_connection_tracker_) |
| 540 peer_connection_tracker_->TrackRemoveStream( | 553 peer_connection_tracker_->TrackRemoveStream( |
| 541 this, stream, PeerConnectionTracker::SOURCE_LOCAL); | 554 this, stream, PeerConnectionTracker::SOURCE_LOCAL); |
| 542 } | 555 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 769 webrtc::SessionDescriptionInterface* native_desc = | 782 webrtc::SessionDescriptionInterface* native_desc = |
| 770 dependency_factory_->CreateSessionDescription(type, sdp, error); | 783 dependency_factory_->CreateSessionDescription(type, sdp, error); |
| 771 | 784 |
| 772 LOG_IF(ERROR, !native_desc) << "Failed to create native session description." | 785 LOG_IF(ERROR, !native_desc) << "Failed to create native session description." |
| 773 << " Type: " << type << " SDP: " << sdp; | 786 << " Type: " << type << " SDP: " << sdp; |
| 774 | 787 |
| 775 return native_desc; | 788 return native_desc; |
| 776 } | 789 } |
| 777 | 790 |
| 778 } // namespace content | 791 } // namespace content |
| OLD | NEW |