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_jsep.h" | 5 #include "content/renderer/media/peer_connection_handler_jsep.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "content/renderer/media/media_stream_dependency_factory.h" | 14 #include "content/renderer/media/media_stream_dependency_factory.h" |
15 #include "content/renderer/media/media_stream_impl.h" | 15 #include "content/renderer/media/media_stream_impl.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICECandid
ateDescriptor.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICECandid
ateDescriptor.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICEOption
s.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebICEOption
s.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne
ction00HandlerClient.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne
ction00HandlerClient.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaHint
s.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaHint
s.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre
amDescriptor.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre
amDescriptor.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre
amSource.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre
amSource.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSessionDe
scriptionDescriptor.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSessionDe
scriptionDescriptor.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
24 | 24 |
25 PeerConnectionHandlerJsep::PeerConnectionHandlerJsep( | 25 PeerConnectionHandlerJsep::PeerConnectionHandlerJsep( |
26 WebKit::WebPeerConnection00HandlerClient* client, | 26 WebKit::WebPeerConnection00HandlerClient* client, |
27 MediaStreamImpl* msi, | |
28 MediaStreamDependencyFactory* dependency_factory) | 27 MediaStreamDependencyFactory* dependency_factory) |
29 : PeerConnectionHandlerBase(msi, dependency_factory), | 28 : PeerConnectionHandlerBase(dependency_factory), |
30 client_(client) { | 29 client_(client) { |
31 } | 30 } |
32 | 31 |
33 PeerConnectionHandlerJsep::~PeerConnectionHandlerJsep() { | 32 PeerConnectionHandlerJsep::~PeerConnectionHandlerJsep() { |
34 } | 33 } |
35 | 34 |
36 void PeerConnectionHandlerJsep::initialize( | 35 void PeerConnectionHandlerJsep::initialize( |
37 const WebKit::WebString& server_configuration, | 36 const WebKit::WebString& server_configuration, |
38 const WebKit::WebString& username) { | 37 const WebKit::WebString& username) { |
39 native_peer_connection_ = dependency_factory_->CreatePeerConnection( | 38 native_peer_connection_ = dependency_factory_->CreatePeerConnection( |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 native_peer_connection_->CommitStreamChanges(); | 175 native_peer_connection_->CommitStreamChanges(); |
177 } | 176 } |
178 | 177 |
179 void PeerConnectionHandlerJsep::removeStream( | 178 void PeerConnectionHandlerJsep::removeStream( |
180 const WebKit::WebMediaStreamDescriptor& stream) { | 179 const WebKit::WebMediaStreamDescriptor& stream) { |
181 RemoveStream(stream); | 180 RemoveStream(stream); |
182 native_peer_connection_->CommitStreamChanges(); | 181 native_peer_connection_->CommitStreamChanges(); |
183 } | 182 } |
184 | 183 |
185 void PeerConnectionHandlerJsep::stop() { | 184 void PeerConnectionHandlerJsep::stop() { |
186 // TODO(ronghuawu): There's an issue with signaling messages being sent during | 185 DVLOG(1) << "PeerConnectionHandlerJsep::stop"; |
187 // close. We need to investigate further. Not calling Close() on native | |
188 // PeerConnection is OK for now. | |
189 native_peer_connection_ = NULL; | 186 native_peer_connection_ = NULL; |
190 media_stream_impl_->ClosePeerConnection(this); | |
191 } | 187 } |
192 | 188 |
193 void PeerConnectionHandlerJsep::OnError() { | 189 void PeerConnectionHandlerJsep::OnError() { |
194 // TODO(grunell): Implement. | 190 // TODO(grunell): Implement. |
195 NOTIMPLEMENTED(); | 191 NOTIMPLEMENTED(); |
196 } | 192 } |
197 | 193 |
198 void PeerConnectionHandlerJsep::OnMessage(const std::string& msg) { | 194 void PeerConnectionHandlerJsep::OnMessage(const std::string& msg) { |
199 // TODO(grunell): Implement. | 195 // TODO(grunell): Implement. |
200 NOTIMPLEMENTED(); | 196 NOTIMPLEMENTED(); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 return false; | 355 return false; |
360 case ActionSDPAnswer: | 356 case ActionSDPAnswer: |
361 *native_action = webrtc::PeerConnectionInterface::kAnswer; | 357 *native_action = webrtc::PeerConnectionInterface::kAnswer; |
362 break; | 358 break; |
363 default: | 359 default: |
364 NOTREACHED(); | 360 NOTREACHED(); |
365 return false; | 361 return false; |
366 } | 362 } |
367 return true; | 363 return true; |
368 } | 364 } |
OLD | NEW |