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