Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: content/renderer/media/rtc_peer_connection_handler.cc

Issue 12084088: Renamed WebMediaStreamComponent and WebMediaStreamDescriptor to WebMediaStreamTrack & WebMediaStream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/rtc_peer_connection_handler.h" 5 #include "content/renderer/media/rtc_peer_connection_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.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/peer_connection_tracker.h" 15 #include "content/renderer/media/peer_connection_tracker.h"
16 #include "content/renderer/media/rtc_data_channel_handler.h" 16 #include "content/renderer/media/rtc_data_channel_handler.h"
17 #include "content/renderer/media/rtc_media_constraints.h" 17 #include "content/renderer/media/rtc_media_constraints.h"
18 #include "content/renderer/render_thread_impl.h" 18 #include "content/renderer/render_thread_impl.h"
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h" 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h"
20 // TODO(hta): Move the following include to WebRTCStatsRequest.h file. 20 // TODO(hta): Move the following include to WebRTCStatsRequest.h file.
21 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamCompo nent.h" 21 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h"
22 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCConfiguration .h" 22 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCConfiguration .h"
23 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCICECandidate. h" 23 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCICECandidate. h"
24 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCPeerConnectio nHandlerClient.h" 24 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCPeerConnectio nHandlerClient.h"
25 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCSessionDescri ption.h" 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCSessionDescri ption.h"
26 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCSessionDescri ptionRequest.h" 26 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCSessionDescri ptionRequest.h"
27 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCStatsRequest. h" 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCStatsRequest. h"
28 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCVoidRequest.h " 28 #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCVoidRequest.h "
29 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" 29 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
31 31
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 response_(NULL) { 264 response_(NULL) {
265 } 265 }
266 266
267 LocalRTCStatsRequest::LocalRTCStatsRequest() {} 267 LocalRTCStatsRequest::LocalRTCStatsRequest() {}
268 LocalRTCStatsRequest::~LocalRTCStatsRequest() {} 268 LocalRTCStatsRequest::~LocalRTCStatsRequest() {}
269 269
270 bool LocalRTCStatsRequest::hasSelector() const { 270 bool LocalRTCStatsRequest::hasSelector() const {
271 return impl_.hasSelector(); 271 return impl_.hasSelector();
272 } 272 }
273 273
274 WebKit::WebMediaStreamDescriptor LocalRTCStatsRequest::stream() const { 274 WebKit::WebMediaStream LocalRTCStatsRequest::stream() const {
275 return impl_.stream(); 275 return impl_.stream();
276 } 276 }
277 277
278 WebKit::WebMediaStreamComponent LocalRTCStatsRequest::component() const { 278 WebKit::WebMediaStreamTrack LocalRTCStatsRequest::component() const {
279 return impl_.component(); 279 return impl_.component();
280 } 280 }
281 281
282 scoped_refptr<LocalRTCStatsResponse> LocalRTCStatsRequest::createResponse() { 282 scoped_refptr<LocalRTCStatsResponse> LocalRTCStatsRequest::createResponse() {
283 DCHECK(!response_); 283 DCHECK(!response_);
284 response_ = new talk_base::RefCountedObject<LocalRTCStatsResponse>( 284 response_ = new talk_base::RefCountedObject<LocalRTCStatsResponse>(
285 impl_.createResponse()); 285 impl_.createResponse());
286 return response_.get(); 286 return response_.get();
287 } 287 }
288 288
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 LOG_IF(ERROR, !return_value) << "Error processing ICE candidate."; 490 LOG_IF(ERROR, !return_value) << "Error processing ICE candidate.";
491 491
492 if (GetPeerConnectionTracker()) 492 if (GetPeerConnectionTracker())
493 GetPeerConnectionTracker()->TrackAddIceCandidate( 493 GetPeerConnectionTracker()->TrackAddIceCandidate(
494 this, candidate, PeerConnectionTracker::SOURCE_REMOTE); 494 this, candidate, PeerConnectionTracker::SOURCE_REMOTE);
495 495
496 return return_value; 496 return return_value;
497 } 497 }
498 498
499 bool RTCPeerConnectionHandler::addStream( 499 bool RTCPeerConnectionHandler::addStream(
500 const WebKit::WebMediaStreamDescriptor& stream, 500 const WebKit::WebMediaStream& stream,
501 const WebKit::WebMediaConstraints& options) { 501 const WebKit::WebMediaConstraints& options) {
502 RTCMediaConstraints constraints(options); 502 RTCMediaConstraints constraints(options);
503 503
504 if (GetPeerConnectionTracker()) 504 if (GetPeerConnectionTracker())
505 GetPeerConnectionTracker()->TrackAddStream( 505 GetPeerConnectionTracker()->TrackAddStream(
506 this, stream, PeerConnectionTracker::SOURCE_LOCAL); 506 this, stream, PeerConnectionTracker::SOURCE_LOCAL);
507 return AddStream(stream, &constraints); 507 return AddStream(stream, &constraints);
508 } 508 }
509 509
510 void RTCPeerConnectionHandler::removeStream( 510 void RTCPeerConnectionHandler::removeStream(
511 const WebKit::WebMediaStreamDescriptor& stream) { 511 const WebKit::WebMediaStream& stream) {
512 RemoveStream(stream); 512 RemoveStream(stream);
513 if (GetPeerConnectionTracker()) 513 if (GetPeerConnectionTracker())
514 GetPeerConnectionTracker()->TrackRemoveStream( 514 GetPeerConnectionTracker()->TrackRemoveStream(
515 this, stream, PeerConnectionTracker::SOURCE_LOCAL); 515 this, stream, PeerConnectionTracker::SOURCE_LOCAL);
516 } 516 }
517 517
518 void RTCPeerConnectionHandler::getStats( 518 void RTCPeerConnectionHandler::getStats(
519 const WebKit::WebRTCStatsRequest& request) { 519 const WebKit::WebRTCStatsRequest& request) {
520 scoped_refptr<LocalRTCStatsRequest> inner_request( 520 scoped_refptr<LocalRTCStatsRequest> inner_request(
521 new talk_base::RefCountedObject<LocalRTCStatsRequest>(request)); 521 new talk_base::RefCountedObject<LocalRTCStatsRequest>(request));
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 GetPeerConnectionTracker()->TrackIceStateChange(this, state); 609 GetPeerConnectionTracker()->TrackIceStateChange(this, state);
610 break; 610 break;
611 } 611 }
612 default: 612 default:
613 NOTREACHED(); 613 NOTREACHED();
614 break; 614 break;
615 } 615 }
616 } 616 }
617 617
618 void RTCPeerConnectionHandler::OnAddStream( 618 void RTCPeerConnectionHandler::OnAddStream(
619 webrtc::MediaStreamInterface* stream) { 619 webrtc::MediaStreamInterface* stream_interface) {
620 DCHECK(stream); 620 DCHECK(stream_interface);
621 DCHECK(remote_streams_.find(stream) == remote_streams_.end()); 621 DCHECK(remote_streams_.find(stream_interface) == remote_streams_.end());
622 WebKit::WebMediaStreamDescriptor descriptor = 622 WebKit::WebMediaStream stream =
623 CreateWebKitStreamDescriptor(stream); 623 CreateWebKitStreamDescriptor(stream_interface);
624 remote_streams_.insert( 624 remote_streams_.insert(
625 std::pair<webrtc::MediaStreamInterface*, 625 std::pair<webrtc::MediaStreamInterface*,
626 WebKit::WebMediaStreamDescriptor>(stream, descriptor)); 626 WebKit::WebMediaStream>(stream_interface, stream));
627 client_->didAddRemoteStream(descriptor); 627 client_->didAddRemoteStream(stream);
628 628
629 if (GetPeerConnectionTracker()) 629 if (GetPeerConnectionTracker())
630 GetPeerConnectionTracker()->TrackAddStream( 630 GetPeerConnectionTracker()->TrackAddStream(
631 this, descriptor, PeerConnectionTracker::SOURCE_REMOTE); 631 this, stream, PeerConnectionTracker::SOURCE_REMOTE);
632 } 632 }
633 633
634 void RTCPeerConnectionHandler::OnRemoveStream( 634 void RTCPeerConnectionHandler::OnRemoveStream(
635 webrtc::MediaStreamInterface* stream) { 635 webrtc::MediaStreamInterface* stream_interface) {
636 DCHECK(stream); 636 DCHECK(stream_interface);
637 RemoteStreamMap::iterator it = remote_streams_.find(stream); 637 RemoteStreamMap::iterator it = remote_streams_.find(stream_interface);
638 if (it == remote_streams_.end()) { 638 if (it == remote_streams_.end()) {
639 NOTREACHED() << "Stream not found"; 639 NOTREACHED() << "Stream not found";
640 return; 640 return;
641 } 641 }
642 WebKit::WebMediaStreamDescriptor descriptor = it->second; 642 WebKit::WebMediaStream stream = it->second;
643 DCHECK(!descriptor.isNull()); 643 DCHECK(!stream.isNull());
644 remote_streams_.erase(it); 644 remote_streams_.erase(it);
645 client_->didRemoveRemoteStream(descriptor); 645 client_->didRemoveRemoteStream(stream);
646 646
647 if (GetPeerConnectionTracker()) 647 if (GetPeerConnectionTracker())
648 GetPeerConnectionTracker()->TrackRemoveStream( 648 GetPeerConnectionTracker()->TrackRemoveStream(
649 this, descriptor, PeerConnectionTracker::SOURCE_REMOTE); 649 this, stream, PeerConnectionTracker::SOURCE_REMOTE);
650 } 650 }
651 651
652 void RTCPeerConnectionHandler::OnIceCandidate( 652 void RTCPeerConnectionHandler::OnIceCandidate(
653 const webrtc::IceCandidateInterface* candidate) { 653 const webrtc::IceCandidateInterface* candidate) {
654 DCHECK(candidate); 654 DCHECK(candidate);
655 std::string sdp; 655 std::string sdp;
656 if (!candidate->ToString(&sdp)) { 656 if (!candidate->ToString(&sdp)) {
657 NOTREACHED() << "OnIceCandidate: Could not get SDP string."; 657 NOTREACHED() << "OnIceCandidate: Could not get SDP string.";
658 return; 658 return;
659 } 659 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 webrtc::SessionDescriptionInterface* native_desc = 699 webrtc::SessionDescriptionInterface* native_desc =
700 dependency_factory_->CreateSessionDescription(type, sdp); 700 dependency_factory_->CreateSessionDescription(type, sdp);
701 701
702 LOG_IF(ERROR, !native_desc) << "Failed to create native session description." 702 LOG_IF(ERROR, !native_desc) << "Failed to create native session description."
703 << " Type: " << type << " SDP: " << sdp; 703 << " Type: " << type << " SDP: " << sdp;
704 704
705 return native_desc; 705 return native_desc;
706 } 706 }
707 707
708 } // namespace content 708 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_peer_connection_handler.h ('k') | content/renderer/media/rtc_peer_connection_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698