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

Unified Diff: talk/app/webrtc/mediastreamsignaling.cc

Issue 1231613002: Fixing scenario where track is rejected and later un-rejected. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removing debug log messages Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: talk/app/webrtc/mediastreamsignaling.cc
diff --git a/talk/app/webrtc/mediastreamsignaling.cc b/talk/app/webrtc/mediastreamsignaling.cc
index 1f5f14fd7b55a3e6641349058f03ed1c38bfdb4a..22ab983dc0aa63a5dfb144dcfa3f858842c9d71f 100644
--- a/talk/app/webrtc/mediastreamsignaling.cc
+++ b/talk/app/webrtc/mediastreamsignaling.cc
@@ -526,6 +526,8 @@ void MediaStreamSignaling::OnLocalDescriptionChanged(
if (audio_content) {
if (audio_content->rejected) {
RejectRemoteTracks(cricket::MEDIA_TYPE_AUDIO);
+ } else {
+ AcceptRemoteTracks(cricket::MEDIA_TYPE_AUDIO);
}
const cricket::AudioContentDescription* audio_desc =
static_cast<const cricket::AudioContentDescription*>(
@@ -538,6 +540,8 @@ void MediaStreamSignaling::OnLocalDescriptionChanged(
if (video_content) {
if (video_content->rejected) {
RejectRemoteTracks(cricket::MEDIA_TYPE_VIDEO);
+ } else {
+ AcceptRemoteTracks(cricket::MEDIA_TYPE_VIDEO);
}
const cricket::VideoContentDescription* video_desc =
static_cast<const cricket::VideoContentDescription*>(
@@ -703,6 +707,27 @@ void MediaStreamSignaling::RejectRemoteTracks(cricket::MediaType media_type) {
}
}
+void MediaStreamSignaling::AcceptRemoteTracks(cricket::MediaType media_type) {
pthatcher1 2015/07/08 20:45:32 Can you avoid duplication by making a helper metho
Taylor Brandstetter 2015/07/08 23:04:03 Sure, that should be fine as long as accepting/rej
+ TrackInfos* current_tracks = GetRemoteTracks(media_type);
+ for (TrackInfos::iterator track_it = current_tracks->begin();
+ track_it != current_tracks->end(); ++track_it) {
+ const TrackInfo& info = *track_it;
+ MediaStreamInterface* stream = remote_streams_->find(info.stream_label);
+ if (media_type == cricket::MEDIA_TYPE_AUDIO) {
+ AudioTrackInterface* track = stream->FindAudioTrack(info.track_id);
+ if (track) {
+ track->set_state(webrtc::MediaStreamTrackInterface::kLive);
+ }
+ }
+ if (media_type == cricket::MEDIA_TYPE_VIDEO) {
+ VideoTrackInterface* track = stream->FindVideoTrack(info.track_id);
+ if (track) {
+ track->set_state(webrtc::MediaStreamTrackInterface::kLive);
+ }
+ }
+ }
+}
+
void MediaStreamSignaling::UpdateEndedRemoteMediaStreams() {
std::vector<scoped_refptr<MediaStreamInterface> > streams_to_remove;
for (size_t i = 0; i < remote_streams_->count(); ++i) {

Powered by Google App Engine
This is Rietveld 408576698