Send audio and video codecs to RTPPayloadRegistry
The purpose with this CL is to be able to send video codec specific information down to RTPPayloadRegistry. We already do this for audio with explicit arguments for e.g. number of channels. Instead of extracting the arguments from webrtc::CodecInst (audio) and webrtc::VideoCodec, this CL sends the types unmodified all the way down to RTPPayloadRegistry. This CL does not contain any functional changes, and is just a preparation for future CL:s. In the dependent CL https://codereview.webrtc.org/2524923002/, RTPPayloadStrategy is removed. RTPPayloadStrategy previously handled audio/video specific aspects of payload handling. After this CL, we will know if we get audio or video codecs without any dependency injection, since we have different functions with different signatures for audio vs video. BUG=webrtc:6743 TBR=mflodman Review-Url: https://codereview.webrtc.org/2523843002 Cr-Commit-Position: refs/heads/master@{#15231}
This commit is contained in:
@ -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_);
|
||||
|
||||
Reference in New Issue
Block a user