| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 } | 523 } |
| 522 | 524 |
| 523 bool RTCPeerConnectionHandler::addStream( | 525 bool RTCPeerConnectionHandler::addStream( |
| 524 const WebKit::WebMediaStream& stream, | 526 const WebKit::WebMediaStream& stream, |
| 525 const WebKit::WebMediaConstraints& options) { | 527 const WebKit::WebMediaConstraints& options) { |
| 526 RTCMediaConstraints constraints(options); | 528 RTCMediaConstraints constraints(options); |
| 527 | 529 |
| 528 if (peer_connection_tracker_) | 530 if (peer_connection_tracker_) |
| 529 peer_connection_tracker_->TrackAddStream( | 531 peer_connection_tracker_->TrackAddStream( |
| 530 this, stream, PeerConnectionTracker::SOURCE_LOCAL); | 532 this, stream, PeerConnectionTracker::SOURCE_LOCAL); |
| 533 |
| 534 // A media stream is connected to a peer connection, enable the |
| 535 // peer connection mode for the capturer. |
| 536 WebRtcAudioDeviceImpl* audio_device = |
| 537 dependency_factory_->GetWebRtcAudioDevice(); |
| 538 if (audio_device) { |
| 539 WebRtcAudioCapturer* capturer = audio_device->GetDefaultCapturer(); |
| 540 if (capturer) |
| 541 capturer->EnablePeerConnectionMode(); |
| 542 } |
| 543 |
| 531 return AddStream(stream, &constraints); | 544 return AddStream(stream, &constraints); |
| 532 } | 545 } |
| 533 | 546 |
| 534 void RTCPeerConnectionHandler::removeStream( | 547 void RTCPeerConnectionHandler::removeStream( |
| 535 const WebKit::WebMediaStream& stream) { | 548 const WebKit::WebMediaStream& stream) { |
| 536 RemoveStream(stream); | 549 RemoveStream(stream); |
| 537 if (peer_connection_tracker_) | 550 if (peer_connection_tracker_) |
| 538 peer_connection_tracker_->TrackRemoveStream( | 551 peer_connection_tracker_->TrackRemoveStream( |
| 539 this, stream, PeerConnectionTracker::SOURCE_LOCAL); | 552 this, stream, PeerConnectionTracker::SOURCE_LOCAL); |
| 540 } | 553 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 webrtc::SessionDescriptionInterface* native_desc = | 780 webrtc::SessionDescriptionInterface* native_desc = |
| 768 dependency_factory_->CreateSessionDescription(type, sdp, error); | 781 dependency_factory_->CreateSessionDescription(type, sdp, error); |
| 769 | 782 |
| 770 LOG_IF(ERROR, !native_desc) << "Failed to create native session description." | 783 LOG_IF(ERROR, !native_desc) << "Failed to create native session description." |
| 771 << " Type: " << type << " SDP: " << sdp; | 784 << " Type: " << type << " SDP: " << sdp; |
| 772 | 785 |
| 773 return native_desc; | 786 return native_desc; |
| 774 } | 787 } |
| 775 | 788 |
| 776 } // namespace content | 789 } // namespace content |
| OLD | NEW |