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.h" | 5 #include "content/renderer/media/peer_connection_handler.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/WebMediaStre amDescriptor.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ctionHandlerClient.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPeerConne ctionHandlerClient.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
20 | 20 |
21 PeerConnectionHandler::PeerConnectionHandler( | 21 PeerConnectionHandler::PeerConnectionHandler( |
22 WebKit::WebPeerConnectionHandlerClient* client, | 22 WebKit::WebPeerConnectionHandlerClient* client, |
23 MediaStreamImpl* msi, | |
24 MediaStreamDependencyFactory* dependency_factory) | 23 MediaStreamDependencyFactory* dependency_factory) |
25 : PeerConnectionHandlerBase(msi, dependency_factory), | 24 : PeerConnectionHandlerBase(dependency_factory), |
26 client_(client) { | 25 client_(client) { |
26 DVLOG(1) << "PeerConnectionHandler::PeerConnectionHandler"; | |
perkj_chrome
2012/05/13 13:39:18
Remove this log
perkj_chrome
2012/05/14 11:50:25
Done.
| |
27 } | 27 } |
28 | 28 |
29 PeerConnectionHandler::~PeerConnectionHandler() { | 29 PeerConnectionHandler::~PeerConnectionHandler() { |
30 DVLOG(1) << "PeerConnectionHandler::~PeerConnectionHandler"; | |
perkj_chrome
2012/05/13 13:39:18
Remove this log.
perkj_chrome
2012/05/14 11:50:25
Done.
| |
30 } | 31 } |
31 | 32 |
32 void PeerConnectionHandler::initialize( | 33 void PeerConnectionHandler::initialize( |
33 const WebKit::WebString& server_configuration, | 34 const WebKit::WebString& server_configuration, |
34 const WebKit::WebString& username) { | 35 const WebKit::WebString& username) { |
35 native_peer_connection_ = dependency_factory_->CreateRoapPeerConnection( | 36 native_peer_connection_ = dependency_factory_->CreateRoapPeerConnection( |
36 UTF16ToUTF8(server_configuration), | 37 UTF16ToUTF8(server_configuration), |
37 this); | 38 this); |
38 CHECK(native_peer_connection_); | 39 CHECK(native_peer_connection_); |
39 } | 40 } |
(...skipping 27 matching lines...) Expand all Loading... | |
67 } | 68 } |
68 | 69 |
69 void PeerConnectionHandler::sendDataStreamMessage( | 70 void PeerConnectionHandler::sendDataStreamMessage( |
70 const char* data, | 71 const char* data, |
71 size_t length) { | 72 size_t length) { |
72 // TODO(grunell): Implement. | 73 // TODO(grunell): Implement. |
73 NOTIMPLEMENTED(); | 74 NOTIMPLEMENTED(); |
74 } | 75 } |
75 | 76 |
76 void PeerConnectionHandler::stop() { | 77 void PeerConnectionHandler::stop() { |
78 DVLOG(1) << "PeerConnectionHandler::stop"; | |
77 // TODO(ronghuawu): There's an issue with signaling messages being sent during | 79 // TODO(ronghuawu): There's an issue with signaling messages being sent during |
78 // close. We need to investigate further. Not calling Close() on native | 80 // close. We need to investigate further. Not calling Close() on native |
79 // PeerConnection is OK for now. | 81 // PeerConnection is OK for now. |
80 native_peer_connection_ = NULL; | 82 native_peer_connection_ = NULL; |
81 media_stream_impl_->ClosePeerConnection(this); | |
82 } | 83 } |
83 | 84 |
84 void PeerConnectionHandler::OnError() { | 85 void PeerConnectionHandler::OnError() { |
85 // TODO(grunell): Implement. | 86 // TODO(grunell): Implement. |
86 NOTIMPLEMENTED(); | 87 NOTIMPLEMENTED(); |
87 } | 88 } |
88 | 89 |
89 void PeerConnectionHandler::OnMessage(const std::string& msg) { | 90 void PeerConnectionHandler::OnMessage(const std::string& msg) { |
90 // TODO(grunell): Implement. | 91 // TODO(grunell): Implement. |
91 NOTIMPLEMENTED(); | 92 NOTIMPLEMENTED(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 RemoteStreamMap::iterator it = remote_streams_.find(stream); | 164 RemoteStreamMap::iterator it = remote_streams_.find(stream); |
164 if (it == remote_streams_.end()) { | 165 if (it == remote_streams_.end()) { |
165 NOTREACHED() << "Stream not found"; | 166 NOTREACHED() << "Stream not found"; |
166 return; | 167 return; |
167 } | 168 } |
168 WebKit::WebMediaStreamDescriptor descriptor = it->second; | 169 WebKit::WebMediaStreamDescriptor descriptor = it->second; |
169 DCHECK(!descriptor.isNull()); | 170 DCHECK(!descriptor.isNull()); |
170 remote_streams_.erase(it); | 171 remote_streams_.erase(it); |
171 client_->didRemoveRemoteStream(descriptor); | 172 client_->didRemoveRemoteStream(descriptor); |
172 } | 173 } |
OLD | NEW |