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

Unified Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 2806173002: Fix RtpReceiver.GetParameters when SSRCs aren't signaled. (Closed)
Patch Set: Changing behavior slightly in response to comment on https://github.com/w3c/webrtc-pc/issues/1116 Created 3 years, 8 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: webrtc/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index 4aa97e049ec5c34333696e7dcb6038cdeb7150c0..2384ac28f173870959c97b6bc78224f931a03464 100644
--- a/webrtc/media/engine/webrtcvoiceengine.cc
+++ b/webrtc/media/engine/webrtcvoiceengine.cc
@@ -1755,19 +1755,31 @@ bool WebRtcVoiceMediaChannel::SetRtpSendParameters(
webrtc::RtpParameters WebRtcVoiceMediaChannel::GetRtpReceiveParameters(
uint32_t ssrc) const {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- auto it = recv_streams_.find(ssrc);
- if (it == recv_streams_.end()) {
- LOG(LS_WARNING) << "Attempting to get RTP receive parameters for stream "
- << "with ssrc " << ssrc << " which doesn't exist.";
- return webrtc::RtpParameters();
+ webrtc::RtpParameters rtp_params;
+ // SSRC of 0 represents the default receive stream.
+ if (ssrc == 0) {
+ if (!default_sink_) {
+ LOG(LS_WARNING) << "Attempting to get RTP parameters for the default, "
+ "unsignaled audio receive stream, but not yet "
+ "configured to receive such a stream.";
+ return rtp_params;
+ }
+ rtp_params.encodings.emplace_back();
+ } else {
+ auto it = recv_streams_.find(ssrc);
+ if (it == recv_streams_.end()) {
+ LOG(LS_WARNING) << "Attempting to get RTP receive parameters for stream "
+ << "with ssrc " << ssrc << " which doesn't exist.";
+ return webrtc::RtpParameters();
+ }
+ rtp_params.encodings.emplace_back();
+ // TODO(deadbeef): Return stream-specific parameters.
+ rtp_params.encodings[0].ssrc = rtc::Optional<uint32_t>(ssrc);
}
- // TODO(deadbeef): Return stream-specific parameters.
- webrtc::RtpParameters rtp_params = CreateRtpParametersWithOneEncoding();
for (const AudioCodec& codec : recv_codecs_) {
rtp_params.codecs.push_back(codec.ToCodecParameters());
}
- rtp_params.encodings[0].ssrc = rtc::Optional<uint32_t>(ssrc);
return rtp_params;
}
@@ -1775,11 +1787,21 @@ bool WebRtcVoiceMediaChannel::SetRtpReceiveParameters(
uint32_t ssrc,
const webrtc::RtpParameters& parameters) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- auto it = recv_streams_.find(ssrc);
- if (it == recv_streams_.end()) {
- LOG(LS_WARNING) << "Attempting to set RTP receive parameters for stream "
- << "with ssrc " << ssrc << " which doesn't exist.";
- return false;
+ // SSRC of 0 represents the default receive stream.
+ if (ssrc == 0) {
+ if (!default_sink_) {
+ LOG(LS_WARNING) << "Attempting to set RTP parameters for the default, "
+ "unsignaled audio receive stream, but not yet "
+ "configured to receive such a stream.";
+ return false;
+ }
+ } else {
+ auto it = recv_streams_.find(ssrc);
+ if (it == recv_streams_.end()) {
+ LOG(LS_WARNING) << "Attempting to set RTP receive parameters for stream "
+ << "with ssrc " << ssrc << " which doesn't exist.";
+ return false;
+ }
}
webrtc::RtpParameters current_parameters = GetRtpReceiveParameters(ssrc);
@@ -2320,6 +2342,7 @@ int WebRtcVoiceMediaChannel::GetOutputLevel() {
bool WebRtcVoiceMediaChannel::SetOutputVolume(uint32_t ssrc, double volume) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
std::vector<uint32_t> ssrcs(1, ssrc);
+ // SSRC of 0 represents the default receive stream.
if (ssrc == 0) {
default_recv_volume_ = volume;
ssrcs = unsignaled_recv_ssrcs_;
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2_unittest.cc ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698