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

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

Issue 1917193008: Adding getParameters/setParameters APIs to RtpReceiver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: objc compile errors Created 4 years, 7 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 00b17c1a9d538cd67e232abb7018bd1fb3d237ab..cc5c4c69043fa26af6ca04fc5aac323a62119afd 100644
--- a/webrtc/media/engine/webrtcvideoengine2.cc
+++ b/webrtc/media/engine/webrtcvideoengine2.cc
@@ -875,13 +875,13 @@ bool WebRtcVideoChannel2::SetSendParameters(const VideoSendParameters& params) {
return true;
}
-webrtc::RtpParameters WebRtcVideoChannel2::GetRtpParameters(
+webrtc::RtpParameters WebRtcVideoChannel2::GetRtpSendParameters(
uint32_t ssrc) const {
rtc::CritScope stream_lock(&stream_crit_);
auto it = send_streams_.find(ssrc);
if (it == send_streams_.end()) {
- LOG(LS_WARNING) << "Attempting to get RTP parameters for stream with ssrc "
- << ssrc << " which doesn't exist.";
+ LOG(LS_WARNING) << "Attempting to get RTP send parameters for stream "
+ << "with ssrc " << ssrc << " which doesn't exist.";
return webrtc::RtpParameters();
}
@@ -894,23 +894,69 @@ webrtc::RtpParameters WebRtcVideoChannel2::GetRtpParameters(
return rtp_params;
}
-bool WebRtcVideoChannel2::SetRtpParameters(
+bool WebRtcVideoChannel2::SetRtpSendParameters(
uint32_t ssrc,
const webrtc::RtpParameters& parameters) {
- TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpParameters");
+ TRACE_EVENT0("webrtc", "WebRtcVideoChannel2::SetRtpSendParameters");
rtc::CritScope stream_lock(&stream_crit_);
auto it = send_streams_.find(ssrc);
if (it == send_streams_.end()) {
- LOG(LS_ERROR) << "Attempting to set RTP parameters for stream with ssrc "
- << ssrc << " which doesn't exist.";
+ LOG(LS_ERROR) << "Attempting to set RTP send parameters for stream "
+ << "with ssrc " << ssrc << " which doesn't exist.";
return false;
}
// TODO(deadbeef): Handle setting parameters with a list of codecs in a
// different order (which should change the send codec).
+ webrtc::RtpParameters current_parameters = GetRtpSendParameters(ssrc);
+ if (current_parameters.codecs != parameters.codecs) {
+ LOG(LS_ERROR) << "Using SetParameters to change the set of codecs "
+ << "is not currently supported.";
+ return false;
+ }
+
return it->second->SetRtpParameters(parameters);
}
+webrtc::RtpParameters WebRtcVideoChannel2::GetRtpReceiveParameters(
+ uint32_t ssrc) const {
+ 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();
+ }
+
+ // TODO(deadbeef): Return stream-specific parameters.
+ webrtc::RtpParameters rtp_params = CreateRtpParametersWithOneEncoding();
+ for (const VideoCodec& codec : recv_params_.codecs) {
+ rtp_params.codecs.push_back(codec.ToCodecParameters());
+ }
+ return rtp_params;
+}
+
+bool WebRtcVideoChannel2::SetRtpReceiveParameters(
+ uint32_t ssrc,
+ 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;
+ }
+
+ webrtc::RtpParameters current_parameters = GetRtpReceiveParameters(ssrc);
+ if (current_parameters != parameters) {
+ LOG(LS_ERROR) << "Changing the RTP receive parameters is currently "
+ << "unsupported.";
+ return false;
+ }
+ return true;
+}
+
bool WebRtcVideoChannel2::GetChangedRecvParameters(
const VideoRecvParameters& params,
ChangedRecvParameters* changed_params) const {
« 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