| 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_audio_source.h" | 
| 17 #include "content/renderer/media/media_stream_dependency_factory.h" | 18 #include "content/renderer/media/media_stream_dependency_factory.h" | 
| 18 #include "content/renderer/media/media_stream_source_extra_data.h" |  | 
| 19 #include "content/renderer/media/peer_connection_tracker.h" | 19 #include "content/renderer/media/peer_connection_tracker.h" | 
| 20 #include "content/renderer/media/remote_media_stream_impl.h" | 20 #include "content/renderer/media/remote_media_stream_impl.h" | 
| 21 #include "content/renderer/media/rtc_data_channel_handler.h" | 21 #include "content/renderer/media/rtc_data_channel_handler.h" | 
| 22 #include "content/renderer/media/rtc_dtmf_sender_handler.h" | 22 #include "content/renderer/media/rtc_dtmf_sender_handler.h" | 
| 23 #include "content/renderer/media/rtc_media_constraints.h" | 23 #include "content/renderer/media/rtc_media_constraints.h" | 
| 24 #include "content/renderer/media/webrtc_audio_capturer.h" | 24 #include "content/renderer/media/webrtc_audio_capturer.h" | 
| 25 #include "content/renderer/media/webrtc_audio_device_impl.h" | 25 #include "content/renderer/media/webrtc_audio_device_impl.h" | 
| 26 #include "content/renderer/render_thread_impl.h" | 26 #include "content/renderer/render_thread_impl.h" | 
| 27 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 27 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 
| 28 // TODO(hta): Move the following include to WebRTCStatsRequest.h file. | 28 // TODO(hta): Move the following include to WebRTCStatsRequest.h file. | 
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 548   if (peer_connection_tracker_) | 548   if (peer_connection_tracker_) | 
| 549     peer_connection_tracker_->TrackAddStream( | 549     peer_connection_tracker_->TrackAddStream( | 
| 550         this, stream, PeerConnectionTracker::SOURCE_LOCAL); | 550         this, stream, PeerConnectionTracker::SOURCE_LOCAL); | 
| 551 | 551 | 
| 552   // A media stream is connected to a peer connection, enable the | 552   // A media stream is connected to a peer connection, enable the | 
| 553   // peer connection mode for the sources. | 553   // peer connection mode for the sources. | 
| 554   blink::WebVector<blink::WebMediaStreamTrack> audio_tracks; | 554   blink::WebVector<blink::WebMediaStreamTrack> audio_tracks; | 
| 555   stream.audioTracks(audio_tracks); | 555   stream.audioTracks(audio_tracks); | 
| 556   for (size_t i = 0; i < audio_tracks.size(); ++i) { | 556   for (size_t i = 0; i < audio_tracks.size(); ++i) { | 
| 557     const blink::WebMediaStreamSource& source = audio_tracks[i].source(); | 557     const blink::WebMediaStreamSource& source = audio_tracks[i].source(); | 
| 558     MediaStreamSourceExtraData* extra_data = | 558     MediaStreamAudioSource* audio_source = | 
| 559         static_cast<MediaStreamSourceExtraData*>(source.extraData()); | 559         static_cast<MediaStreamAudioSource*>(source.extraData()); | 
| 560     // |extra_data| is NULL if the track is a remote audio track. | 560     // |audio_source| is NULL if the track is a remote audio track. | 
| 561     if (extra_data && extra_data->GetAudioCapturer()) | 561     if (audio_source && audio_source->GetAudioCapturer()) | 
| 562       extra_data->GetAudioCapturer()->EnablePeerConnectionMode(); | 562       audio_source->GetAudioCapturer()->EnablePeerConnectionMode(); | 
| 563   } | 563   } | 
| 564 | 564 | 
| 565   return AddStream(stream, &constraints); | 565   return AddStream(stream, &constraints); | 
| 566 } | 566 } | 
| 567 | 567 | 
| 568 void RTCPeerConnectionHandler::removeStream( | 568 void RTCPeerConnectionHandler::removeStream( | 
| 569     const blink::WebMediaStream& stream) { | 569     const blink::WebMediaStream& stream) { | 
| 570   RemoveStream(stream); | 570   RemoveStream(stream); | 
| 571   if (peer_connection_tracker_) | 571   if (peer_connection_tracker_) | 
| 572     peer_connection_tracker_->TrackRemoveStream( | 572     peer_connection_tracker_->TrackRemoveStream( | 
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 802   webrtc::SessionDescriptionInterface* native_desc = | 802   webrtc::SessionDescriptionInterface* native_desc = | 
| 803       dependency_factory_->CreateSessionDescription(type, sdp, error); | 803       dependency_factory_->CreateSessionDescription(type, sdp, error); | 
| 804 | 804 | 
| 805   LOG_IF(ERROR, !native_desc) << "Failed to create native session description." | 805   LOG_IF(ERROR, !native_desc) << "Failed to create native session description." | 
| 806                               << " Type: " << type << " SDP: " << sdp; | 806                               << " Type: " << type << " SDP: " << sdp; | 
| 807 | 807 | 
| 808   return native_desc; | 808   return native_desc; | 
| 809 } | 809 } | 
| 810 | 810 | 
| 811 }  // namespace content | 811 }  // namespace content | 
| OLD | NEW | 
|---|