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

Unified Diff: webrtc/media/engine/webrtcvideoengine2.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
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvideoengine2.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2.cc b/webrtc/media/engine/webrtcvideoengine2.cc
index 087fc4e011d7a7066534e4a892238a93f0ee4be5..e92598d408d53e057a3b61bb815f18f854afde42 100644
--- a/webrtc/media/engine/webrtcvideoengine2.cc
+++ b/webrtc/media/engine/webrtcvideoengine2.cc
@@ -865,20 +865,33 @@ bool WebRtcVideoChannel2::SetRtpSendParameters(
webrtc::RtpParameters WebRtcVideoChannel2::GetRtpReceiveParameters(
uint32_t ssrc) const {
+ webrtc::RtpParameters rtp_params;
rtc::CritScope stream_lock(&stream_crit_);
- auto it = receive_streams_.find(ssrc);
- if (it == receive_streams_.end()) {
- LOG(LS_WARNING) << "Attempting to get RTP receive parameters for stream "
- << "with ssrc " << ssrc << " which doesn't exist.";
- return webrtc::RtpParameters();
+ // SSRC of 0 represents an unsignaled receive stream.
+ if (ssrc == 0) {
+ if (!default_unsignalled_ssrc_handler_.GetDefaultSink()) {
+ LOG(LS_WARNING) << "Attempting to get RTP parameters for the default, "
+ "unsignaled video receive stream, but not yet "
+ "configured to receive such a stream.";
+ return rtp_params;
+ }
+ rtp_params.encodings.emplace_back();
+ } else {
+ auto it = receive_streams_.find(ssrc);
+ if (it == receive_streams_.end()) {
+ LOG(LS_WARNING) << "Attempting to get RTP receive parameters for stream "
+ << "with SSRC " << ssrc << " which doesn't exist.";
+ return webrtc::RtpParameters();
+ }
+ // TODO(deadbeef): Return stream-specific parameters, beyond just SSRC.
+ rtp_params.encodings.emplace_back();
+ rtp_params.encodings[0].ssrc = it->second->GetFirstPrimarySsrc();
}
- // TODO(deadbeef): Return stream-specific parameters.
- webrtc::RtpParameters rtp_params = CreateRtpParametersWithOneEncoding();
+ // Add codecs, which any stream is prepared to receive.
for (const VideoCodec& codec : recv_params_.codecs) {
rtp_params.codecs.push_back(codec.ToCodecParameters());
}
- rtp_params.encodings[0].ssrc = it->second->GetFirstPrimarySsrc();
return rtp_params;
}
@@ -887,11 +900,22 @@ bool WebRtcVideoChannel2::SetRtpReceiveParameters(
const webrtc::RtpParameters& parameters) {
TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpReceiveParameters");
rtc::CritScope stream_lock(&stream_crit_);
- auto it = receive_streams_.find(ssrc);
- if (it == receive_streams_.end()) {
- LOG(LS_ERROR) << "Attempting to set RTP receive parameters for stream "
- << "with ssrc " << ssrc << " which doesn't exist.";
- return false;
+
+ // SSRC of 0 represents an unsignaled receive stream.
+ if (ssrc == 0) {
+ if (!default_unsignalled_ssrc_handler_.GetDefaultSink()) {
+ LOG(LS_WARNING) << "Attempting to set RTP parameters for the default, "
+ "unsignaled video receive stream, but not yet "
+ "configured to receive such a stream.";
+ return false;
+ }
+ } else {
+ auto it = receive_streams_.find(ssrc);
+ if (it == receive_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);
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698