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

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

Issue 1428243005: Fix for scenario where m-line is revived after being set to port 0. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 VideoRtpSender::VideoRtpSender(VideoTrackInterface* track, 138 VideoRtpSender::VideoRtpSender(VideoTrackInterface* track,
139 uint32_t ssrc, 139 uint32_t ssrc,
140 VideoProviderInterface* provider) 140 VideoProviderInterface* provider)
141 : id_(track->id()), 141 : id_(track->id()),
142 track_(track), 142 track_(track),
143 ssrc_(ssrc), 143 ssrc_(ssrc),
144 provider_(provider), 144 provider_(provider),
145 cached_track_enabled_(track->enabled()) { 145 cached_track_enabled_(track->enabled()) {
146 track_->RegisterObserver(this); 146 track_->RegisterObserver(this);
147 VideoSourceInterface* source = track_->GetSource();
148 if (source) {
149 provider_->SetCaptureDevice(ssrc_, source->GetVideoCapturer());
150 }
151 Reconfigure(); 147 Reconfigure();
152 } 148 }
153 149
154 VideoRtpSender::~VideoRtpSender() { 150 VideoRtpSender::~VideoRtpSender() {
155 track_->UnregisterObserver(this); 151 track_->UnregisterObserver(this);
156 Stop(); 152 Stop();
157 } 153 }
158 154
159 void VideoRtpSender::OnChanged() { 155 void VideoRtpSender::OnChanged() {
160 if (cached_track_enabled_ != track_->enabled()) { 156 if (cached_track_enabled_ != track_->enabled()) {
161 cached_track_enabled_ = track_->enabled(); 157 cached_track_enabled_ = track_->enabled();
162 Reconfigure(); 158 SetVideoSend();
163 } 159 }
164 } 160 }
165 161
166 bool VideoRtpSender::SetTrack(MediaStreamTrackInterface* track) { 162 bool VideoRtpSender::SetTrack(MediaStreamTrackInterface* track) {
167 if (track->kind() != "video") { 163 if (track->kind() != "video") {
168 LOG(LS_ERROR) << "SetTrack called on video RtpSender with " << track->kind() 164 LOG(LS_ERROR) << "SetTrack called on video RtpSender with " << track->kind()
169 << " track."; 165 << " track.";
170 return false; 166 return false;
171 } 167 }
172 VideoTrackInterface* video_track = static_cast<VideoTrackInterface*>(track); 168 VideoTrackInterface* video_track = static_cast<VideoTrackInterface*>(track);
(...skipping 16 matching lines...) Expand all
189 } 185 }
190 provider_->SetCaptureDevice(ssrc_, nullptr); 186 provider_->SetCaptureDevice(ssrc_, nullptr);
191 provider_->SetVideoSend(ssrc_, false, nullptr); 187 provider_->SetVideoSend(ssrc_, false, nullptr);
192 provider_ = nullptr; 188 provider_ = nullptr;
193 } 189 }
194 190
195 void VideoRtpSender::Reconfigure() { 191 void VideoRtpSender::Reconfigure() {
196 if (!provider_) { 192 if (!provider_) {
197 return; 193 return;
198 } 194 }
195 VideoSourceInterface* source = track_->GetSource();
196 if (source) {
197 provider_->SetCaptureDevice(ssrc_, source->GetVideoCapturer());
pthatcher1 2015/11/11 00:45:02 Is there any downside to calling this all the time
Taylor Brandstetter 2015/11/11 01:33:30 If you trace your way down to WebRtcVideoChannel2:
198 }
199 SetVideoSend();
200 }
201
202 void VideoRtpSender::SetVideoSend() {
pthatcher1 2015/11/11 00:45:02 Actually, if this is separate, calling something l
Taylor Brandstetter 2015/11/11 01:33:30 Done.
203 if (!provider_) {
204 return;
205 }
206 VideoSourceInterface* source = track_->GetSource();
199 const cricket::VideoOptions* options = nullptr; 207 const cricket::VideoOptions* options = nullptr;
200 VideoSourceInterface* source = track_->GetSource();
201 if (track_->enabled() && source) { 208 if (track_->enabled() && source) {
202 options = source->options(); 209 options = source->options();
203 } 210 }
204 provider_->SetVideoSend(ssrc_, track_->enabled(), options); 211 provider_->SetVideoSend(ssrc_, track_->enabled(), options);
205 } 212 }
206 213
207 } // namespace webrtc 214 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698