| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/renderer/media/peer_connection_tracker.h" | 4 #include "content/renderer/media/peer_connection_tracker.h" |
| 5 | 5 |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "content/common/media/peer_connection_tracker_messages.h" | 7 #include "content/common/media/peer_connection_tracker_messages.h" |
| 8 #include "content/renderer/media/rtc_media_constraints.h" | 8 #include "content/renderer/media/rtc_media_constraints.h" |
| 9 #include "content/renderer/media/rtc_peer_connection_handler.h" | 9 #include "content/renderer/media/rtc_peer_connection_handler.h" |
| 10 #include "content/renderer/render_thread_impl.h" | 10 #include "content/renderer/render_thread_impl.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 Source source) { | 369 Source source) { |
| 370 string value = "label: " + data_channel->label() + | 370 string value = "label: " + data_channel->label() + |
| 371 ", reliable: " + (data_channel->reliable() ? "true" : "false"); | 371 ", reliable: " + (data_channel->reliable() ? "true" : "false"); |
| 372 SendPeerConnectionUpdate( | 372 SendPeerConnectionUpdate( |
| 373 pc_handler, | 373 pc_handler, |
| 374 source == SOURCE_LOCAL ? "createLocalDataChannel" : "onRemoteDataChannel", | 374 source == SOURCE_LOCAL ? "createLocalDataChannel" : "onRemoteDataChannel", |
| 375 value); | 375 value); |
| 376 } | 376 } |
| 377 | 377 |
| 378 void PeerConnectionTracker::TrackStop(RTCPeerConnectionHandler* pc_handler) { | 378 void PeerConnectionTracker::TrackStop(RTCPeerConnectionHandler* pc_handler) { |
| 379 SendPeerConnectionUpdate(pc_handler, "stop", ""); | 379 SendPeerConnectionUpdate(pc_handler, "stop", std::string()); |
| 380 } | 380 } |
| 381 | 381 |
| 382 void PeerConnectionTracker::TrackSignalingStateChange( | 382 void PeerConnectionTracker::TrackSignalingStateChange( |
| 383 RTCPeerConnectionHandler* pc_handler, | 383 RTCPeerConnectionHandler* pc_handler, |
| 384 WebRTCPeerConnectionHandlerClient::SignalingState state) { | 384 WebRTCPeerConnectionHandlerClient::SignalingState state) { |
| 385 SendPeerConnectionUpdate( | 385 SendPeerConnectionUpdate( |
| 386 pc_handler, "signalingStateChange", GetSignalingStateString(state)); | 386 pc_handler, "signalingStateChange", GetSignalingStateString(state)); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void PeerConnectionTracker::TrackIceConnectionStateChange( | 389 void PeerConnectionTracker::TrackIceConnectionStateChange( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 NOTREACHED(); | 423 NOTREACHED(); |
| 424 break; | 424 break; |
| 425 } | 425 } |
| 426 update_type += callback_type; | 426 update_type += callback_type; |
| 427 | 427 |
| 428 SendPeerConnectionUpdate(pc_handler, update_type, value); | 428 SendPeerConnectionUpdate(pc_handler, update_type, value); |
| 429 } | 429 } |
| 430 | 430 |
| 431 void PeerConnectionTracker::TrackOnRenegotiationNeeded( | 431 void PeerConnectionTracker::TrackOnRenegotiationNeeded( |
| 432 RTCPeerConnectionHandler* pc_handler) { | 432 RTCPeerConnectionHandler* pc_handler) { |
| 433 SendPeerConnectionUpdate(pc_handler, "onRenegotiationNeeded", ""); | 433 SendPeerConnectionUpdate(pc_handler, "onRenegotiationNeeded", std::string()); |
| 434 } | 434 } |
| 435 | 435 |
| 436 void PeerConnectionTracker::TrackCreateDTMFSender( | 436 void PeerConnectionTracker::TrackCreateDTMFSender( |
| 437 RTCPeerConnectionHandler* pc_handler, | 437 RTCPeerConnectionHandler* pc_handler, |
| 438 const WebKit::WebMediaStreamTrack& track) { | 438 const WebKit::WebMediaStreamTrack& track) { |
| 439 SendPeerConnectionUpdate(pc_handler, "createDTMFSender", | 439 SendPeerConnectionUpdate(pc_handler, "createDTMFSender", |
| 440 UTF16ToUTF8(track.id())); | 440 UTF16ToUTF8(track.id())); |
| 441 } | 441 } |
| 442 | 442 |
| 443 int PeerConnectionTracker::GetNextLocalID() { | 443 int PeerConnectionTracker::GetNextLocalID() { |
| 444 return next_lid_++; | 444 return next_lid_++; |
| 445 } | 445 } |
| 446 | 446 |
| 447 void PeerConnectionTracker::SendPeerConnectionUpdate( | 447 void PeerConnectionTracker::SendPeerConnectionUpdate( |
| 448 RTCPeerConnectionHandler* pc_handler, | 448 RTCPeerConnectionHandler* pc_handler, |
| 449 const std::string& type, | 449 const std::string& type, |
| 450 const std::string& value) { | 450 const std::string& value) { |
| 451 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) | 451 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) |
| 452 return; | 452 return; |
| 453 | 453 |
| 454 RenderThreadImpl::current()->Send( | 454 RenderThreadImpl::current()->Send( |
| 455 new PeerConnectionTrackerHost_UpdatePeerConnection( | 455 new PeerConnectionTrackerHost_UpdatePeerConnection( |
| 456 peer_connection_id_map_[pc_handler], type, value)); | 456 peer_connection_id_map_[pc_handler], type, value)); |
| 457 } | 457 } |
| 458 | 458 |
| 459 } // namespace content | 459 } // namespace content |
| OLD | NEW |