summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/webrtc/voice_engine/voe_rtp_rtcp_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/webrtc/voice_engine/voe_rtp_rtcp_impl.cc')
-rw-r--r--chromium/third_party/webrtc/voice_engine/voe_rtp_rtcp_impl.cc368
1 files changed, 126 insertions, 242 deletions
diff --git a/chromium/third_party/webrtc/voice_engine/voe_rtp_rtcp_impl.cc b/chromium/third_party/webrtc/voice_engine/voe_rtp_rtcp_impl.cc
index 945c5384b36..8f0e717edf1 100644
--- a/chromium/third_party/webrtc/voice_engine/voe_rtp_rtcp_impl.cc
+++ b/chromium/third_party/webrtc/voice_engine/voe_rtp_rtcp_impl.cc
@@ -11,6 +11,7 @@
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/file_wrapper.h"
#include "webrtc/system_wrappers/interface/trace.h"
+#include "webrtc/video_engine/include/vie_network.h"
#include "webrtc/voice_engine/include/voe_errors.h"
#include "webrtc/voice_engine/voe_rtp_rtcp_impl.h"
#include "webrtc/voice_engine/voice_engine_impl.h"
@@ -49,88 +50,6 @@ VoERTP_RTCPImpl::~VoERTP_RTCPImpl()
"VoERTP_RTCPImpl::~VoERTP_RTCPImpl() - dtor");
}
-int VoERTP_RTCPImpl::RegisterRTPObserver(int channel, VoERTPObserver& observer)
-{
- WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "RegisterRTPObserver(channel=%d observer=0x%x)",
- channel, &observer);
- if (!_shared->statistics().Initialized())
- {
- _shared->SetLastError(VE_NOT_INITED, kTraceError);
- return -1;
- }
- voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
- voe::Channel* channelPtr = ch.channel();
- if (channelPtr == NULL)
- {
- _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "RegisterRTPObserver() failed to locate channel");
- return -1;
- }
- return channelPtr->RegisterRTPObserver(observer);
-}
-
-int VoERTP_RTCPImpl::DeRegisterRTPObserver(int channel)
-{
- WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "DeRegisterRTPObserver(channel=%d)", channel);
- if (!_shared->statistics().Initialized())
- {
- _shared->SetLastError(VE_NOT_INITED, kTraceError);
- return -1;
- }
- voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
- voe::Channel* channelPtr = ch.channel();
- if (channelPtr == NULL)
- {
- _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "DeRegisterRTPObserver() failed to locate channel");
- return -1;
- }
- return channelPtr->DeRegisterRTPObserver();
-}
-
-int VoERTP_RTCPImpl::RegisterRTCPObserver(int channel, VoERTCPObserver& observer)
-{
- WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "RegisterRTCPObserver(channel=%d observer=0x%x)",
- channel, &observer);
- if (!_shared->statistics().Initialized())
- {
- _shared->SetLastError(VE_NOT_INITED, kTraceError);
- return -1;
- }
- voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
- voe::Channel* channelPtr = ch.channel();
- if (channelPtr == NULL)
- {
- _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "RegisterRTPObserver() failed to locate channel");
- return -1;
- }
- return channelPtr->RegisterRTCPObserver(observer);
-}
-
-int VoERTP_RTCPImpl::DeRegisterRTCPObserver(int channel)
-{
- WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "DeRegisterRTCPObserver(channel=%d)", channel);
- if (!_shared->statistics().Initialized())
- {
- _shared->SetLastError(VE_NOT_INITED, kTraceError);
- return -1;
- }
- voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
- voe::Channel* channelPtr = ch.channel();
- if (channelPtr == NULL)
- {
- _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "DeRegisterRTCPObserver() failed to locate channel");
- return -1;
- }
- return channelPtr->DeRegisterRTCPObserver();
-}
-
int VoERTP_RTCPImpl::SetLocalSSRC(int channel, unsigned int ssrc)
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
@@ -191,82 +110,126 @@ int VoERTP_RTCPImpl::GetRemoteSSRC(int channel, unsigned int& ssrc)
return channelPtr->GetRemoteSSRC(ssrc);
}
-int VoERTP_RTCPImpl::GetRemoteCSRCs(int channel, unsigned int arrCSRC[15])
-{
- WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "GetRemoteCSRCs(channel=%d, arrCSRC=?)", channel);
- if (!_shared->statistics().Initialized())
- {
- _shared->SetLastError(VE_NOT_INITED, kTraceError);
- return -1;
- }
- voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
- voe::Channel* channelPtr = ch.channel();
- if (channelPtr == NULL)
- {
- _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "GetRemoteCSRCs() failed to locate channel");
- return -1;
- }
- return channelPtr->GetRemoteCSRCs(arrCSRC);
-}
-
-
-int VoERTP_RTCPImpl::SetRTPAudioLevelIndicationStatus(int channel,
- bool enable,
- unsigned char ID)
+int VoERTP_RTCPImpl::SetSendAudioLevelIndicationStatus(int channel,
+ bool enable,
+ unsigned char id)
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "SetRTPAudioLevelIndicationStatus(channel=%d, enable=%d,"
- " ID=%u)", channel, enable, ID);
+ "SetSendAudioLevelIndicationStatus(channel=%d, enable=%d,"
+ " ID=%u)", channel, enable, id);
if (!_shared->statistics().Initialized())
{
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
- if (enable && (ID < kVoiceEngineMinRtpExtensionId ||
- ID > kVoiceEngineMaxRtpExtensionId))
+ if (enable && (id < kVoiceEngineMinRtpExtensionId ||
+ id > kVoiceEngineMaxRtpExtensionId))
{
- // [RFC5285] The 4-bit ID is the local identifier of this element in
+ // [RFC5285] The 4-bit id is the local identifier of this element in
// the range 1-14 inclusive.
_shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
- "SetRTPAudioLevelIndicationStatus() invalid ID parameter");
+ "SetSendAudioLevelIndicationStatus() invalid ID parameter");
return -1;
}
- // Set state and ID for the specified channel.
+ // Set state and id for the specified channel.
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "SetRTPAudioLevelIndicationStatus() failed to locate channel");
+ "SetSendAudioLevelIndicationStatus() failed to locate channel");
return -1;
}
- return channelPtr->SetRTPAudioLevelIndicationStatus(enable, ID);
+ return channelPtr->SetSendAudioLevelIndicationStatus(enable, id);
}
-int VoERTP_RTCPImpl::GetRTPAudioLevelIndicationStatus(int channel,
- bool& enabled,
- unsigned char& ID)
-{
- WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "GetRTPAudioLevelIndicationStatus(channel=%d, enable=?, ID=?)",
- channel);
- if (!_shared->statistics().Initialized())
- {
- _shared->SetLastError(VE_NOT_INITED, kTraceError);
- return -1;
- }
- voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
- voe::Channel* channelPtr = ch.channel();
- if (channelPtr == NULL)
- {
- _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "GetRTPAudioLevelIndicationStatus() failed to locate channel");
- return -1;
- }
- return channelPtr->GetRTPAudioLevelIndicationStatus(enabled, ID);
+int VoERTP_RTCPImpl::SetReceiveAudioLevelIndicationStatus(int channel,
+ bool enable,
+ unsigned char id) {
+ WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
+ "SetReceiveAudioLevelIndicationStatus(channel=%d, enable=%d, id=%u)",
+ channel, enable, id);
+ if (!_shared->statistics().Initialized()) {
+ _shared->SetLastError(VE_NOT_INITED, kTraceError);
+ return -1;
+ }
+ if (enable &&
+ (id < kVoiceEngineMinRtpExtensionId ||
+ id > kVoiceEngineMaxRtpExtensionId)) {
+ // [RFC5285] The 4-bit id is the local identifier of this element in
+ // the range 1-14 inclusive.
+ _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
+ "SetReceiveAbsoluteSenderTimeStatus() invalid id parameter");
+ return -1;
+ }
+ // Set state and id for the specified channel.
+ voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
+ voe::Channel* channel_ptr = ch.channel();
+ if (channel_ptr == NULL) {
+ _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
+ "SetReceiveAudioLevelIndicationStatus() failed to locate channel");
+ return -1;
+ }
+ return channel_ptr->SetReceiveAudioLevelIndicationStatus(enable, id);
+}
+
+int VoERTP_RTCPImpl::SetSendAbsoluteSenderTimeStatus(int channel,
+ bool enable,
+ unsigned char id) {
+ WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
+ "SetSendAbsoluteSenderTimeStatus(channel=%d, enable=%d, id=%u)",
+ channel, enable, id);
+ if (!_shared->statistics().Initialized()) {
+ _shared->SetLastError(VE_NOT_INITED, kTraceError);
+ return -1;
+ }
+ if (enable && (id < kVoiceEngineMinRtpExtensionId ||
+ id > kVoiceEngineMaxRtpExtensionId)) {
+ // [RFC5285] The 4-bit id is the local identifier of this element in
+ // the range 1-14 inclusive.
+ _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
+ "SetSendAbsoluteSenderTimeStatus() invalid id parameter");
+ return -1;
+ }
+ // Set state and id for the specified channel.
+ voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
+ voe::Channel* channelPtr = ch.channel();
+ if (channelPtr == NULL) {
+ _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
+ "SetSendAbsoluteSenderTimeStatus() failed to locate channel");
+ return -1;
+ }
+ return channelPtr->SetSendAbsoluteSenderTimeStatus(enable, id);
+}
+
+int VoERTP_RTCPImpl::SetReceiveAbsoluteSenderTimeStatus(int channel,
+ bool enable,
+ unsigned char id) {
+ WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
+ "SetReceiveAbsoluteSenderTimeStatus(channel=%d, enable=%d, id=%u)",
+ channel, enable, id);
+ if (!_shared->statistics().Initialized()) {
+ _shared->SetLastError(VE_NOT_INITED, kTraceError);
+ return -1;
+ }
+ if (enable && (id < kVoiceEngineMinRtpExtensionId ||
+ id > kVoiceEngineMaxRtpExtensionId)) {
+ // [RFC5285] The 4-bit id is the local identifier of this element in
+ // the range 1-14 inclusive.
+ _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError,
+ "SetReceiveAbsoluteSenderTimeStatus() invalid id parameter");
+ return -1;
+ }
+ // Set state and id for the specified channel.
+ voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
+ voe::Channel* channelPtr = ch.channel();
+ if (channelPtr == NULL) {
+ _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
+ "SetReceiveAbsoluteSenderTimeStatus() failed to locate channel");
+ return -1;
+ }
+ return channelPtr->SetReceiveAbsoluteSenderTimeStatus(enable, id);
}
int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable)
@@ -401,36 +364,6 @@ int VoERTP_RTCPImpl::GetRemoteRTCPData(
fractionLost);
}
-int VoERTP_RTCPImpl::SendApplicationDefinedRTCPPacket(
- int channel,
- unsigned char subType,
- unsigned int name,
- const char* data,
- unsigned short dataLengthInBytes)
-{
- WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "SendApplicationDefinedRTCPPacket(channel=%d, subType=%u,"
- "name=%u, data=?, dataLengthInBytes=%u)",
- channel, subType, name, dataLengthInBytes);
- if (!_shared->statistics().Initialized())
- {
- _shared->SetLastError(VE_NOT_INITED, kTraceError);
- return -1;
- }
- voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
- voe::Channel* channelPtr = ch.channel();
- if (channelPtr == NULL)
- {
- _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "SendApplicationDefinedRTCPPacket() failed to locate channel");
- return -1;
- }
- return channelPtr->SendApplicationDefinedRTCPPacket(subType,
- name,
- data,
- dataLengthInBytes);
-}
-
int VoERTP_RTCPImpl::GetRTPStatistics(int channel,
unsigned int& averageJitterMs,
unsigned int& maxJitterMs,
@@ -476,24 +409,6 @@ int VoERTP_RTCPImpl::GetRTCPStatistics(int channel, CallStatistics& stats)
return channelPtr->GetRTPStatistics(stats);
}
-int VoERTP_RTCPImpl::GetRemoteRTCPSenderInfo(int channel,
- SenderInfo* sender_info) {
- WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "GetRemoteRTCPSenderInfo(channel=%d)", channel);
- if (!_shared->statistics().Initialized()) {
- _shared->SetLastError(VE_NOT_INITED, kTraceError);
- return -1;
- }
- voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
- voe::Channel* channel_ptr = ch.channel();
- if (channel_ptr == NULL) {
- _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "GetRemoteRTCPSenderInfo() failed to locate channel");
- return -1;
- }
- return channel_ptr->GetRemoteRTCPSenderInfo(sender_info);
-}
-
int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks(
int channel, std::vector<ReportBlock>* report_blocks) {
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
@@ -512,10 +427,10 @@ int VoERTP_RTCPImpl::GetRemoteRTCPReportBlocks(
return channel_ptr->GetRemoteRTCPReportBlocks(report_blocks);
}
-int VoERTP_RTCPImpl::SetFECStatus(int channel, bool enable, int redPayloadtype)
+int VoERTP_RTCPImpl::SetREDStatus(int channel, bool enable, int redPayloadtype)
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "SetFECStatus(channel=%d, enable=%d, redPayloadtype=%d)",
+ "SetREDStatus(channel=%d, enable=%d, redPayloadtype=%d)",
channel, enable, redPayloadtype);
#ifdef WEBRTC_CODEC_RED
if (!_shared->statistics().Initialized())
@@ -528,23 +443,23 @@ int VoERTP_RTCPImpl::SetFECStatus(int channel, bool enable, int redPayloadtype)
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "SetFECStatus() failed to locate channel");
+ "SetREDStatus() failed to locate channel");
return -1;
}
- return channelPtr->SetFECStatus(enable, redPayloadtype);
+ return channelPtr->SetREDStatus(enable, redPayloadtype);
#else
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
- "SetFECStatus() RED is not supported");
+ "SetREDStatus() RED is not supported");
return -1;
#endif
}
-int VoERTP_RTCPImpl::GetFECStatus(int channel,
+int VoERTP_RTCPImpl::GetREDStatus(int channel,
bool& enabled,
int& redPayloadtype)
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "GetFECStatus(channel=%d, enabled=?, redPayloadtype=?)",
+ "GetREDStatus(channel=%d, enabled=?, redPayloadtype=?)",
channel);
#ifdef WEBRTC_CODEC_RED
if (!_shared->statistics().Initialized())
@@ -557,18 +472,17 @@ int VoERTP_RTCPImpl::GetFECStatus(int channel,
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "GetFECStatus() failed to locate channel");
+ "GetREDStatus() failed to locate channel");
return -1;
}
- return channelPtr->GetFECStatus(enabled, redPayloadtype);
+ return channelPtr->GetREDStatus(enabled, redPayloadtype);
#else
_shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError,
- "GetFECStatus() RED is not supported");
+ "GetREDStatus() RED is not supported");
return -1;
#endif
}
-
int VoERTP_RTCPImpl::SetNACKStatus(int channel,
bool enable,
int maxNoPackets)
@@ -655,55 +569,25 @@ int VoERTP_RTCPImpl::RTPDumpIsActive(int channel, RTPDirections direction)
return channelPtr->RTPDumpIsActive(direction);
}
-int VoERTP_RTCPImpl::InsertExtraRTPPacket(int channel,
- unsigned char payloadType,
- bool markerBit,
- const char* payloadData,
- unsigned short payloadSize)
-{
- WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "InsertExtraRTPPacket(channel=%d, payloadType=%u,"
- " markerBit=%u, payloadSize=%u)",
- channel, payloadType, markerBit, payloadSize);
-
- if (!_shared->statistics().Initialized())
- {
- _shared->SetLastError(VE_NOT_INITED, kTraceError);
- return -1;
- }
- voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
- voe::Channel* channelPtr = ch.channel();
- if (channelPtr == NULL)
- {
- _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "InsertExtraRTPPacket() failed to locate channel");
- return -1;
- }
- return channelPtr->InsertExtraRTPPacket(payloadType,
- markerBit,
- payloadData,
- payloadSize);
-}
+int VoERTP_RTCPImpl::SetVideoEngineBWETarget(int channel,
+ ViENetwork* vie_network,
+ int video_channel) {
+ WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
+ "SetVideoEngineBWETarget(channel=%d, vie_network=?, video_channel=%d)",
+ channel, vie_network, video_channel);
-int VoERTP_RTCPImpl::GetLastRemoteTimeStamp(int channel,
- uint32_t* timestamp) {
- WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
- "GetLastRemoteTimeStamp(channel=%d, timestamp=?)", channel);
- if (!_shared->statistics().Initialized())
- {
- _shared->SetLastError(VE_NOT_INITED, kTraceError);
- return -1;
- }
- voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
- voe::Channel* channelPtr = ch.channel();
- if (channelPtr == NULL)
- {
- _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
- "GetLastRemoteTimeStamp() failed to locate channel");
- return -1;
+ voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
+ voe::Channel* channelPtr = ch.channel();
+ if (channelPtr == NULL) {
+ _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
+ "SetVideoEngineBWETarget() failed to locate channel");
+ if (vie_network) {
+ vie_network->Release();
}
- *timestamp = channelPtr->LastRemoteTimeStamp();
- return 0;
+ return -1;
+ }
+ channelPtr->SetVideoEngineBWETarget(vie_network, video_channel);
+ return 0;
}
#endif // #ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API