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

Side by Side Diff: talk/app/webrtc/peerconnection.cc

Issue 1247443005: Revert of Fixing scenario where track is rejected and later un-rejected. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « talk/app/webrtc/mediastreamsignaling.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 return; 607 return;
608 } 608 }
609 // Update stats here so that we have the most recent stats for tracks and 609 // Update stats here so that we have the most recent stats for tracks and
610 // streams that might be removed by updating the session description. 610 // streams that might be removed by updating the session description.
611 stats_->UpdateStats(kStatsOutputLevelStandard); 611 stats_->UpdateStats(kStatsOutputLevelStandard);
612 std::string error; 612 std::string error;
613 if (!session_->SetLocalDescription(desc, &error)) { 613 if (!session_->SetLocalDescription(desc, &error)) {
614 PostSetSessionDescriptionFailure(observer, error); 614 PostSetSessionDescriptionFailure(observer, error);
615 return; 615 return;
616 } 616 }
617
618 // This is necessary because an audio/video channel may have been previously
619 // destroyed by removing it from the remote description, which would NOT
620 // destroy the local handler. So upon receiving a new local description,
621 // we may need to tell that local track handler to connect the capturer
622 // to the now re-created audio/video channel.
623 stream_handler_container_->RestartAllLocalTracks();
624
625 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); 617 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer);
626 signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); 618 signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg);
627 } 619 }
628 620
629 void PeerConnection::SetRemoteDescription( 621 void PeerConnection::SetRemoteDescription(
630 SetSessionDescriptionObserver* observer, 622 SetSessionDescriptionObserver* observer,
631 SessionDescriptionInterface* desc) { 623 SessionDescriptionInterface* desc) {
632 if (!VERIFY(observer != NULL)) { 624 if (!VERIFY(observer != NULL)) {
633 LOG(LS_ERROR) << "SetRemoteDescription - observer is NULL."; 625 LOG(LS_ERROR) << "SetRemoteDescription - observer is NULL.";
634 return; 626 return;
635 } 627 }
636 if (!desc) { 628 if (!desc) {
637 PostSetSessionDescriptionFailure(observer, "SessionDescription is NULL."); 629 PostSetSessionDescriptionFailure(observer, "SessionDescription is NULL.");
638 return; 630 return;
639 } 631 }
640 // Update stats here so that we have the most recent stats for tracks and 632 // Update stats here so that we have the most recent stats for tracks and
641 // streams that might be removed by updating the session description. 633 // streams that might be removed by updating the session description.
642 stats_->UpdateStats(kStatsOutputLevelStandard); 634 stats_->UpdateStats(kStatsOutputLevelStandard);
643 std::string error; 635 std::string error;
644 if (!session_->SetRemoteDescription(desc, &error)) { 636 if (!session_->SetRemoteDescription(desc, &error)) {
645 PostSetSessionDescriptionFailure(observer, error); 637 PostSetSessionDescriptionFailure(observer, error);
646 return; 638 return;
647 } 639 }
648
649 // This is necessary because an audio/video channel may have been previously
650 // destroyed by removing it from the local description, which would NOT
651 // destroy the remote handler. So upon receiving a new remote description,
652 // we may need to tell that remote track handler to connect the renderer
653 // to the now re-created audio/video channel.
654 stream_handler_container_->RestartAllRemoteTracks();
655
656 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); 640 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer);
657 signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg); 641 signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_SUCCESS, msg);
658 } 642 }
659 643
660 void PeerConnection::PostSetSessionDescriptionFailure( 644 void PeerConnection::PostSetSessionDescriptionFailure(
661 SetSessionDescriptionObserver* observer, 645 SetSessionDescriptionObserver* observer,
662 const std::string& error) { 646 const std::string& error) {
663 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer); 647 SetSessionDescriptionMsg* msg = new SetSessionDescriptionMsg(observer);
664 msg->error = error; 648 msg->error = error;
665 signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_FAILED, msg); 649 signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_FAILED, msg);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 if (ice_gathering_state_ != kIceGatheringComplete) { 895 if (ice_gathering_state_ != kIceGatheringComplete) {
912 ice_gathering_state_ = kIceGatheringComplete; 896 ice_gathering_state_ = kIceGatheringComplete;
913 observer_->OnIceGatheringChange(ice_gathering_state_); 897 observer_->OnIceGatheringChange(ice_gathering_state_);
914 } 898 }
915 } 899 }
916 observer_->OnSignalingChange(signaling_state_); 900 observer_->OnSignalingChange(signaling_state_);
917 observer_->OnStateChange(PeerConnectionObserver::kSignalingState); 901 observer_->OnStateChange(PeerConnectionObserver::kSignalingState);
918 } 902 }
919 903
920 } // namespace webrtc 904 } // namespace webrtc
OLDNEW
« no previous file with comments | « talk/app/webrtc/mediastreamsignaling.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698