| 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/peer_connection_handler_base.h" | 5 #include "content/renderer/media/peer_connection_handler_base.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "content/renderer/media/media_stream_dependency_factory.h" | 9 #include "content/renderer/media/media_stream_dependency_factory.h" |
| 10 #include "content/renderer/media/media_stream_extra_data.h" | 10 #include "content/renderer/media/media_stream_extra_data.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 void PeerConnectionHandlerBase::AddStream( | 33 void PeerConnectionHandlerBase::AddStream( |
| 34 const WebKit::WebMediaStreamDescriptor& stream) { | 34 const WebKit::WebMediaStreamDescriptor& stream) { |
| 35 webrtc::LocalMediaStreamInterface* native_stream = | 35 webrtc::LocalMediaStreamInterface* native_stream = |
| 36 GetLocalNativeMediaStream(stream); | 36 GetLocalNativeMediaStream(stream); |
| 37 if (native_stream) | 37 if (native_stream) |
| 38 native_peer_connection_->AddStream(native_stream); | 38 native_peer_connection_->AddStream(native_stream); |
| 39 DCHECK(native_stream); | 39 DCHECK(native_stream); |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool PeerConnectionHandlerBase::AddStream( |
| 43 const WebKit::WebMediaStreamDescriptor& stream, |
| 44 const webrtc::MediaConstraintsInterface* constraints) { |
| 45 webrtc::LocalMediaStreamInterface* native_stream = |
| 46 GetLocalNativeMediaStream(stream); |
| 47 if (!native_stream) |
| 48 return false; |
| 49 return native_peer_connection_->AddStream(native_stream, constraints); |
| 50 } |
| 51 |
| 42 void PeerConnectionHandlerBase::RemoveStream( | 52 void PeerConnectionHandlerBase::RemoveStream( |
| 43 const WebKit::WebMediaStreamDescriptor& stream) { | 53 const WebKit::WebMediaStreamDescriptor& stream) { |
| 44 webrtc::LocalMediaStreamInterface* native_stream = | 54 webrtc::LocalMediaStreamInterface* native_stream = |
| 45 GetLocalNativeMediaStream(stream); | 55 GetLocalNativeMediaStream(stream); |
| 46 if (native_stream) | 56 if (native_stream) |
| 47 native_peer_connection_->RemoveStream(native_stream); | 57 native_peer_connection_->RemoveStream(native_stream); |
| 48 DCHECK(native_stream); | 58 DCHECK(native_stream); |
| 49 } | 59 } |
| 50 | 60 |
| 51 WebKit::WebMediaStreamDescriptor | 61 WebKit::WebMediaStreamDescriptor |
| (...skipping 25 matching lines...) Expand all Loading... |
| 77 UTF8ToUTF16(video_track->label()), | 87 UTF8ToUTF16(video_track->label()), |
| 78 WebKit::WebMediaStreamSource::TypeVideo, | 88 WebKit::WebMediaStreamSource::TypeVideo, |
| 79 UTF8ToUTF16(video_track->label())); | 89 UTF8ToUTF16(video_track->label())); |
| 80 } | 90 } |
| 81 WebKit::WebMediaStreamDescriptor descriptor; | 91 WebKit::WebMediaStreamDescriptor descriptor; |
| 82 descriptor.initialize(UTF8ToUTF16(stream->label()), | 92 descriptor.initialize(UTF8ToUTF16(stream->label()), |
| 83 audio_source_vector, video_source_vector); | 93 audio_source_vector, video_source_vector); |
| 84 descriptor.setExtraData(new MediaStreamExtraData(stream)); | 94 descriptor.setExtraData(new MediaStreamExtraData(stream)); |
| 85 return descriptor; | 95 return descriptor; |
| 86 } | 96 } |
| OLD | NEW |