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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc

Issue 2523843002: Send audio and video codecs to RTPPayloadRegistry (Closed)
Patch Set: Change strcpy to strncpy Created 4 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc
index 190449b3ddfe6bdde9561cc16a0ce6d1387ed767..1e0bf732ad7d0ca37ede10d196b54c99b79ad997 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc
@@ -16,6 +16,7 @@
#include <string.h>
#include "webrtc/base/logging.h"
+#include "webrtc/common_types.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
@@ -80,12 +81,7 @@ RtpReceiverImpl::~RtpReceiverImpl() {
}
}
-int32_t RtpReceiverImpl::RegisterReceivePayload(
- const char payload_name[RTP_PAYLOAD_NAME_SIZE],
- const int8_t payload_type,
- const uint32_t frequency,
- const size_t channels,
- const uint32_t rate) {
+int32_t RtpReceiverImpl::RegisterReceivePayload(const CodecInst& audio_codec) {
rtc::CritScope lock(&critical_section_rtp_receiver_);
// TODO(phoglund): Try to streamline handling of the RED codec and some other
@@ -93,19 +89,33 @@ int32_t RtpReceiverImpl::RegisterReceivePayload(
// payload or not.
bool created_new_payload = false;
int32_t result = rtp_payload_registry_->RegisterReceivePayload(
- payload_name, payload_type, frequency, channels, rate,
- &created_new_payload);
+ audio_codec, &created_new_payload);
if (created_new_payload) {
- if (rtp_media_receiver_->OnNewPayloadTypeCreated(payload_name, payload_type,
- frequency) != 0) {
- LOG(LS_ERROR) << "Failed to register payload: " << payload_name << "/"
- << static_cast<int>(payload_type);
+ if (rtp_media_receiver_->OnNewPayloadTypeCreated(audio_codec) != 0) {
+ LOG(LS_ERROR) << "Failed to register payload: " << audio_codec.plname
+ << "/" << static_cast<int>(audio_codec.pltype);
return -1;
}
}
return result;
}
+// TODO(magjed): Remove once external code is updated.
+int32_t RtpReceiverImpl::RegisterReceivePayload(
+ const char payload_name[RTP_PAYLOAD_NAME_SIZE],
+ const int8_t payload_type,
+ const uint32_t frequency,
+ const size_t channels,
+ const uint32_t rate) {
+ CodecInst codec;
+ codec.pltype = payload_type;
+ strncpy(codec.plname, payload_name, RTP_PAYLOAD_NAME_SIZE);
+ codec.plfreq = frequency;
+ codec.channels = channels;
+ codec.rate = rate;
+ return RegisterReceivePayload(codec);
+}
+
int32_t RtpReceiverImpl::DeRegisterReceivePayload(
const int8_t payload_type) {
rtc::CritScope lock(&critical_section_rtp_receiver_);
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698