Index: talk/app/webrtc/mediastreamsignaling.cc |
diff --git a/talk/app/webrtc/mediastreamsignaling.cc b/talk/app/webrtc/mediastreamsignaling.cc |
index d126ac5967c0e35d37a6391ca1ccea5eb5fd7aef..1f5f14fd7b55a3e6641349058f03ed1c38bfdb4a 100644 |
--- a/talk/app/webrtc/mediastreamsignaling.cc |
+++ b/talk/app/webrtc/mediastreamsignaling.cc |
@@ -525,13 +525,7 @@ |
GetFirstAudioContent(desc->description()); |
if (audio_content) { |
if (audio_content->rejected) { |
- 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); |
+ RejectRemoteTracks(cricket::MEDIA_TYPE_AUDIO); |
} |
const cricket::AudioContentDescription* audio_desc = |
static_cast<const cricket::AudioContentDescription*>( |
@@ -543,13 +537,7 @@ |
GetFirstVideoContent(desc->description()); |
if (video_content) { |
if (video_content->rejected) { |
- 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); |
+ RejectRemoteTracks(cricket::MEDIA_TYPE_VIDEO); |
} |
const cricket::VideoContentDescription* video_desc = |
static_cast<const cricket::VideoContentDescription*>( |
@@ -571,13 +559,11 @@ |
} |
void MediaStreamSignaling::OnAudioChannelClose() { |
- SetRemoteTracksState(cricket::MEDIA_TYPE_AUDIO, |
- MediaStreamTrackInterface::kEnded); |
+ RejectRemoteTracks(cricket::MEDIA_TYPE_AUDIO); |
} |
void MediaStreamSignaling::OnVideoChannelClose() { |
- SetRemoteTracksState(cricket::MEDIA_TYPE_VIDEO, |
- MediaStreamTrackInterface::kEnded); |
+ RejectRemoteTracks(cricket::MEDIA_TYPE_VIDEO); |
} |
void MediaStreamSignaling::OnDataChannelClose() { |
@@ -692,9 +678,7 @@ |
} |
} |
-void MediaStreamSignaling::SetRemoteTracksState( |
- cricket::MediaType media_type, |
- MediaStreamTrackInterface::TrackState state) { |
+void MediaStreamSignaling::RejectRemoteTracks(cricket::MediaType media_type) { |
TrackInfos* current_tracks = GetRemoteTracks(media_type); |
for (TrackInfos::iterator track_it = current_tracks->begin(); |
track_it != current_tracks->end(); ++track_it) { |
@@ -705,7 +689,7 @@ |
// 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(state); |
+ track->set_state(webrtc::MediaStreamTrackInterface::kEnded); |
} |
} |
if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
@@ -713,7 +697,7 @@ |
// 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(state); |
+ track->set_state(webrtc::MediaStreamTrackInterface::kEnded); |
} |
} |
} |