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

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 obsolete method 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
« no previous file with comments | « talk/app/webrtc/mediastreamsignaling.h ('k') | talk/app/webrtc/peerconnection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/mediastreamsignaling.cc
diff --git a/talk/app/webrtc/mediastreamsignaling.cc b/talk/app/webrtc/mediastreamsignaling.cc
index 1f5f14fd7b55a3e6641349058f03ed1c38bfdb4a..d126ac5967c0e35d37a6391ca1ccea5eb5fd7aef 100644
--- a/talk/app/webrtc/mediastreamsignaling.cc
+++ b/talk/app/webrtc/mediastreamsignaling.cc
@@ -525,7 +525,13 @@ void MediaStreamSignaling::OnLocalDescriptionChanged(
GetFirstAudioContent(desc->description());
if (audio_content) {
if (audio_content->rejected) {
- RejectRemoteTracks(cricket::MEDIA_TYPE_AUDIO);
+ SetRemoteTracksState(cricket::MEDIA_TYPE_AUDIO,
+ MediaStreamTrackInterface::kEnded);
+ } else {
+ // This is needed in case the local description caused the track to be
+ // rejected, then later accepted, without being destroyed.
+ SetRemoteTracksState(cricket::MEDIA_TYPE_AUDIO,
+ MediaStreamTrackInterface::kLive);
}
const cricket::AudioContentDescription* audio_desc =
static_cast<const cricket::AudioContentDescription*>(
@@ -537,7 +543,13 @@ void MediaStreamSignaling::OnLocalDescriptionChanged(
GetFirstVideoContent(desc->description());
if (video_content) {
if (video_content->rejected) {
- RejectRemoteTracks(cricket::MEDIA_TYPE_VIDEO);
+ SetRemoteTracksState(cricket::MEDIA_TYPE_VIDEO,
+ MediaStreamTrackInterface::kEnded);
+ } else {
+ // This is needed in case the local description caused the track to be
+ // rejected, then later accepted, without being destroyed.
+ SetRemoteTracksState(cricket::MEDIA_TYPE_VIDEO,
+ MediaStreamTrackInterface::kLive);
}
const cricket::VideoContentDescription* video_desc =
static_cast<const cricket::VideoContentDescription*>(
@@ -559,11 +571,13 @@ void MediaStreamSignaling::OnLocalDescriptionChanged(
}
void MediaStreamSignaling::OnAudioChannelClose() {
- RejectRemoteTracks(cricket::MEDIA_TYPE_AUDIO);
+ SetRemoteTracksState(cricket::MEDIA_TYPE_AUDIO,
+ MediaStreamTrackInterface::kEnded);
}
void MediaStreamSignaling::OnVideoChannelClose() {
- RejectRemoteTracks(cricket::MEDIA_TYPE_VIDEO);
+ SetRemoteTracksState(cricket::MEDIA_TYPE_VIDEO,
+ MediaStreamTrackInterface::kEnded);
}
void MediaStreamSignaling::OnDataChannelClose() {
@@ -678,7 +692,9 @@ void MediaStreamSignaling::OnRemoteTrackRemoved(
}
}
-void MediaStreamSignaling::RejectRemoteTracks(cricket::MediaType media_type) {
+void MediaStreamSignaling::SetRemoteTracksState(
+ cricket::MediaType media_type,
+ MediaStreamTrackInterface::TrackState state) {
TrackInfos* current_tracks = GetRemoteTracks(media_type);
for (TrackInfos::iterator track_it = current_tracks->begin();
track_it != current_tracks->end(); ++track_it) {
@@ -689,7 +705,7 @@ void MediaStreamSignaling::RejectRemoteTracks(cricket::MediaType media_type) {
// There's no guarantee the track is still available, e.g. the track may
// have been removed from the stream by javascript.
if (track) {
- track->set_state(webrtc::MediaStreamTrackInterface::kEnded);
+ track->set_state(state);
}
}
if (media_type == cricket::MEDIA_TYPE_VIDEO) {
@@ -697,7 +713,7 @@ void MediaStreamSignaling::RejectRemoteTracks(cricket::MediaType media_type) {
// There's no guarantee the track is still available, e.g. the track may
// have been removed from the stream by javascript.
if (track) {
- track->set_state(webrtc::MediaStreamTrackInterface::kEnded);
+ track->set_state(state);
}
}
}
« no previous file with comments | « talk/app/webrtc/mediastreamsignaling.h ('k') | talk/app/webrtc/peerconnection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698