Interface changes to old api, for use by new api transition.

BUG=2589
R=mflodman@webrtc.org, pbos@webrtc.org, stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/3209004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5142 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
sprang@webrtc.org 2013-11-20 16:47:07 +00:00
parent b24d33565c
commit dc50aaeaa8
8 changed files with 374 additions and 170 deletions

View File

@ -225,6 +225,7 @@ protected:
Transport() {}
};
// Statistics for an RTCP channel
struct RtcpStatistics {
public:
RtcpStatistics()
@ -241,6 +242,71 @@ struct RtcpStatistics {
uint32_t max_jitter;
};
// Callback, called whenever a new rtcp report block is transmitted.
class RtcpStatisticsCallback {
public:
virtual ~RtcpStatisticsCallback() {}
virtual void StatisticsUpdated(const RtcpStatistics& statistics,
uint32_t ssrc) = 0;
};
// Data usage statistics for a (rtp) stream
struct StreamDataCounters {
public:
StreamDataCounters()
: bytes(0),
padding_bytes(0),
packets(0),
retransmitted_packets(0),
fec_packets(0) {}
uint32_t bytes;
uint32_t padding_bytes;
uint32_t packets;
uint32_t retransmitted_packets;
uint32_t fec_packets;
};
// Callback, called whenever byte/packet counts have been updated.
class StreamDataCountersCallback {
public:
virtual ~StreamDataCountersCallback() {}
virtual void DataCountersUpdated(const StreamDataCounters& counters,
uint32_t ssrc) = 0;
};
// Rate statistics for a stream
struct BitrateStatistics {
public:
BitrateStatistics()
: bitrate_(0),
packet_rate(0),
now(0) {}
uint32_t bitrate_;
uint32_t packet_rate;
uint64_t now;
};
// Callback, used to notify an observer whenever new rates have been estimated.
class BitrateStatisticsObserver {
public:
virtual ~BitrateStatisticsObserver() {}
virtual void Notify(const BitrateStatistics& stats, uint32_t ssrc) = 0;
};
// Callback, used to notify an observer whenever frame counts have been updated
class FrameCountObserver {
public:
~FrameCountObserver() {}
virtual void Notify(const unsigned int key_frames,
const unsigned int delta_frames,
const unsigned int ssrc) = 0;
};
// ==================================================================
// Voice specific types
// ==================================================================

View File

@ -26,7 +26,7 @@ class VideoRenderCallback;
// This class declares an abstract interface to be used for external renderers.
// The user implemented derived class is registered using AddRenderer().
class WEBRTC_DLLEXPORT ExternalRenderer {
class ExternalRenderer {
public:
// This method will be called when the stream to be rendered changes in
// resolution or number of streams mixed in the image.
@ -52,7 +52,7 @@ class WEBRTC_DLLEXPORT ExternalRenderer {
virtual ~ExternalRenderer() {}
};
class WEBRTC_DLLEXPORT ViERender {
class ViERender {
public:
// Factory for the ViERender subAPI and increases an internal reference
// counter if successful. Returns NULL if the API is not supported or if

View File

@ -262,29 +262,97 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP {
// This function returns our locally created statistics of the received RTP
// stream.
virtual int GetReceivedRTCPStatistics(
const int video_channel,
unsigned short& fraction_lost,
unsigned int& cumulative_lost,
unsigned int& extended_max,
unsigned int& jitter,
int& rtt_ms) const = 0;
virtual int GetReceiveChannelRtcpStatistics(const int video_channel,
RtcpStatistics& basic_stats,
int& rtt_ms) const = 0;
// This function returns statistics reported by the remote client in a RTCP
// packet.
virtual int GetSendChannelRtcpStatistics(const int video_channel,
RtcpStatistics& basic_stats,
int& rtt_ms) const = 0;
// TODO(sprang): Temporary hacks to prevent libjingle build from failing,
// remove when libjingle has been lifted to support webrtc issue 2589
virtual int GetReceivedRTCPStatistics(const int video_channel,
unsigned short& fraction_lost,
unsigned int& cumulative_lost,
unsigned int& extended_max,
unsigned int& jitter,
int& rtt_ms) const {
RtcpStatistics stats;
int ret_code = GetReceiveChannelRtcpStatistics(video_channel,
stats,
rtt_ms);
fraction_lost = stats.fraction_lost;
cumulative_lost = stats.cumulative_lost;
extended_max = stats.extended_max_sequence_number;
jitter = stats.jitter;
return ret_code;
}
virtual int GetSentRTCPStatistics(const int video_channel,
unsigned short& fraction_lost,
unsigned int& cumulative_lost,
unsigned int& extended_max,
unsigned int& jitter,
int& rtt_ms) const = 0;
unsigned short& fraction_lost,
unsigned int& cumulative_lost,
unsigned int& extended_max,
unsigned int& jitter,
int& rtt_ms) const {
RtcpStatistics stats;
int ret_code = GetSendChannelRtcpStatistics(video_channel,
stats,
rtt_ms);
fraction_lost = stats.fraction_lost;
cumulative_lost = stats.cumulative_lost;
extended_max = stats.extended_max_sequence_number;
jitter = stats.jitter;
return ret_code;
}
virtual int RegisterSendChannelRtcpStatisticsCallback(
const int video_channel, RtcpStatisticsCallback* callback) = 0;
virtual int DeregisterSendChannelRtcpStatisticsCallback(
const int video_channel, RtcpStatisticsCallback* callback) = 0;
virtual int RegisterReceiveChannelRtcpStatisticsCallback(
const int video_channel, RtcpStatisticsCallback* callback) = 0;
virtual int DeregisterReceiveChannelRtcpStatisticsCallback(
const int video_channel, RtcpStatisticsCallback* callback) = 0;
// The function gets statistics from the sent and received RTP streams.
virtual int GetRtpStatistics(const int video_channel,
StreamDataCounters& sent,
StreamDataCounters& received) const = 0;
// TODO(sprang): Temporary hacks to prevent libjingle build from failing,
// remove when libjingle has been lifted to support webrtc issue 2589
virtual int GetRTPStatistics(const int video_channel,
unsigned int& bytes_sent,
unsigned int& packets_sent,
unsigned int& bytes_received,
unsigned int& packets_received) const = 0;
unsigned int& bytes_sent,
unsigned int& packets_sent,
unsigned int& bytes_received,
unsigned int& packets_received) const {
StreamDataCounters sent;
StreamDataCounters received;
int ret_code = GetRtpStatistics(video_channel, sent, received);
bytes_sent = sent.bytes;
packets_sent = sent.packets;
bytes_received = received.bytes;
packets_received = received.packets;
return ret_code;
}
virtual int RegisterSendChannelRtpStatisticsCallback(
const int video_channel, StreamDataCountersCallback* callback) = 0;
virtual int DeregisterSendChannelRtpStatisticsCallback(
const int video_channel, StreamDataCountersCallback* callback) = 0;
virtual int RegisterReceiveChannelRtpStatisticsCallback(
const int video_channel, StreamDataCountersCallback* callback) = 0;
virtual int DeregisterReceiveChannelRtpStatisticsCallback(
const int video_channel, StreamDataCountersCallback* callback) = 0;
// The function gets bandwidth usage statistics from the sent RTP streams in
// bits/s.
@ -294,6 +362,15 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP {
unsigned int& fec_bitrate_sent,
unsigned int& nackBitrateSent) const = 0;
// (De)Register an observer, called whenever the send bitrate is updated
virtual int RegisterSendBitrateObserver(
const int video_channel,
BitrateStatisticsObserver* observer) = 0;
virtual int DeregisterSendBitrateObserver(
const int video_channel,
BitrateStatisticsObserver* observer) = 0;
// This function gets the send-side estimated bandwidth available for video,
// including overhead, in bits/s.
virtual int GetEstimatedSendBandwidth(
@ -334,8 +411,15 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP {
// Removes a registered instance of ViERTCPObserver.
virtual int DeregisterRTCPObserver(const int video_channel) = 0;
// Registers and instance of a user implementation of ViEFrameCountObserver
virtual int RegisterSendFrameCountObserver(
const int video_channel, FrameCountObserver* observer) = 0;
// Removes a registered instance of a ViEFrameCountObserver
virtual int DeregisterSendFrameCountObserver(
const int video_channel, FrameCountObserver* observer) = 0;
protected:
ViERTP_RTCP() {}
virtual ~ViERTP_RTCP() {}
};

View File

@ -1509,10 +1509,7 @@ void PrintRTCCPStatistics(webrtc::ViERTP_RTCP* vie_rtp_rtcp,
StatisticsType stat_type) {
int error = 0;
int number_of_errors = 0;
uint16_t fraction_lost = 0;
unsigned int cumulative_lost = 0;
unsigned int extended_max = 0;
unsigned int jitter = 0;
webrtc::RtcpStatistics rtcp_stats;
int rtt_ms = 0;
switch (stat_type) {
@ -1520,11 +1517,9 @@ void PrintRTCCPStatistics(webrtc::ViERTP_RTCP* vie_rtp_rtcp,
std::cout << "RTCP Received statistics"
<< std::endl;
// Get and print the Received RTCP Statistics
error = vie_rtp_rtcp->GetReceivedRTCPStatistics(video_channel,
fraction_lost,
cumulative_lost,
extended_max,
jitter, rtt_ms);
error = vie_rtp_rtcp->GetReceiveChannelRtcpStatistics(video_channel,
rtcp_stats,
rtt_ms);
number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -1533,22 +1528,22 @@ void PrintRTCCPStatistics(webrtc::ViERTP_RTCP* vie_rtp_rtcp,
std::cout << "RTCP Sent statistics"
<< std::endl;
// Get and print the Sent RTCP Statistics
error = vie_rtp_rtcp->GetSentRTCPStatistics(video_channel, fraction_lost,
cumulative_lost, extended_max,
jitter, rtt_ms);
error = vie_rtp_rtcp->GetSendChannelRtcpStatistics(video_channel,
rtcp_stats,
rtt_ms);
number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
break;
}
std::cout << "\tRTCP fraction of lost packets: "
<< fraction_lost << std::endl;
<< rtcp_stats.fraction_lost << std::endl;
std::cout << "\tRTCP cumulative number of lost packets: "
<< cumulative_lost << std::endl;
<< rtcp_stats.cumulative_lost << std::endl;
std::cout << "\tRTCP max received sequence number "
<< extended_max << std::endl;
<< rtcp_stats.extended_max_sequence_number << std::endl;
std::cout << "\tRTCP jitter: "
<< jitter << std::endl;
<< rtcp_stats.jitter << std::endl;
std::cout << "\tRTCP round trip (ms): "
<< rtt_ms << std::endl;
}
@ -1557,29 +1552,25 @@ void PrintRTPStatistics(webrtc::ViERTP_RTCP* vie_rtp_rtcp,
int video_channel) {
int error = 0;
int number_of_errors = 0;
unsigned int bytes_sent = 0;
unsigned int packets_sent = 0;
unsigned int bytes_received = 0;
unsigned int packets_received = 0;
webrtc::StreamDataCounters sent;
webrtc::StreamDataCounters received;
std::cout << "RTP statistics"
<< std::endl;
// Get and print the RTP Statistics
error = vie_rtp_rtcp->GetRTPStatistics(video_channel, bytes_sent,
packets_sent, bytes_received,
packets_received);
error = vie_rtp_rtcp->GetRtpStatistics(video_channel, sent, received);
number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
std::cout << "\tRTP bytes sent: "
<< bytes_sent << std::endl;
<< sent.bytes << std::endl;
std::cout << "\tRTP packets sent: "
<< packets_sent << std::endl;
<< sent.packets << std::endl;
std::cout << "\tRTP bytes received: "
<< bytes_received << std::endl;
<< received.bytes << std::endl;
std::cout << "\tRTP packets received: "
<< packets_received << std::endl;
<< received.packets << std::endl;
}
void PrintBandwidthUsage(webrtc::ViERTP_RTCP* vie_rtp_rtcp,

View File

@ -12,6 +12,7 @@
#include "webrtc/engine_configurations.h"
#include "webrtc/test/testsupport/fileutils.h"
#include "webrtc/video_engine/include/vie_rtp_rtcp.h"
#include "webrtc/video_engine/test/auto_test/interface/vie_autotest.h"
#include "webrtc/video_engine/test/auto_test/interface/vie_autotest_defines.h"
#include "webrtc/video_engine/test/libvietest/include/tb_capture_device.h"
@ -164,10 +165,7 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
//
// Pacing
//
unsigned short recFractionsLost = 0;
unsigned int recCumulativeLost = 0;
unsigned int recExtendedMax = 0;
unsigned int recJitter = 0;
webrtc::RtcpStatistics received;
int recRttMs = 0;
unsigned int sentTotalBitrate = 0;
unsigned int sentVideoBitrate = 0;
@ -193,9 +191,8 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
AutoTestSleep(kAutoTestSleepTimeMs);
EXPECT_EQ(0, ViE.rtp_rtcp->GetReceivedRTCPStatistics(
tbChannel.videoChannel, recFractionsLost, recCumulativeLost,
recExtendedMax, recJitter, recRttMs));
EXPECT_EQ(0, ViE.rtp_rtcp->GetReceiveChannelRtcpStatistics(
tbChannel.videoChannel, received, recRttMs));
EXPECT_EQ(0, ViE.rtp_rtcp->GetBandwidthUsage(
tbChannel.videoChannel, sentTotalBitrate, sentVideoBitrate,
sentFecBitrate, sentNackBitrate));
@ -211,7 +208,7 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
EXPECT_GT(num_rtcp_packets, 0);
EXPECT_GT(sentTotalBitrate, 0u);
EXPECT_EQ(sentNackBitrate, 0u);
EXPECT_EQ(recCumulativeLost, 0u);
EXPECT_EQ(received.cumulative_lost, 0u);
//
// RTX
@ -248,9 +245,8 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
myTransport.SetNetworkParameters(network);
AutoTestSleep(kAutoTestSleepTimeMs);
EXPECT_EQ(0, ViE.rtp_rtcp->GetReceivedRTCPStatistics(
tbChannel.videoChannel, recFractionsLost, recCumulativeLost,
recExtendedMax, recJitter, recRttMs));
EXPECT_EQ(0, ViE.rtp_rtcp->GetReceiveChannelRtcpStatistics(
tbChannel.videoChannel, received, recRttMs));
EXPECT_EQ(0, ViE.rtp_rtcp->GetBandwidthUsage(
tbChannel.videoChannel, sentTotalBitrate, sentVideoBitrate,
sentFecBitrate, sentNackBitrate));
@ -292,10 +288,7 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
AutoTestSleep(kAutoTestSleepTimeMs);
unsigned short sentFractionsLost = 0;
unsigned int sentCumulativeLost = 0;
unsigned int sentExtendedMax = 0;
unsigned int sentJitter = 0;
webrtc::RtcpStatistics sent;
int sentRttMs = 0;
EXPECT_EQ(0, ViE.rtp_rtcp->GetBandwidthUsage(
@ -310,21 +303,19 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
AutoTestSleep(2000);
EXPECT_EQ(0, ViE.rtp_rtcp->GetSentRTCPStatistics(
tbChannel.videoChannel, sentFractionsLost, sentCumulativeLost,
sentExtendedMax, sentJitter, sentRttMs));
EXPECT_GT(sentCumulativeLost, 0u);
EXPECT_GT(sentExtendedMax, startSequenceNumber);
EXPECT_GT(sentJitter, 0u);
EXPECT_EQ(0, ViE.rtp_rtcp->GetSendChannelRtcpStatistics(
tbChannel.videoChannel, sent, sentRttMs));
EXPECT_GT(sent.cumulative_lost, 0u);
EXPECT_GT(sent.extended_max_sequence_number, startSequenceNumber);
EXPECT_GT(sent.jitter, 0u);
EXPECT_GT(sentRttMs, 0);
EXPECT_EQ(0, ViE.rtp_rtcp->GetReceivedRTCPStatistics(
tbChannel.videoChannel, recFractionsLost, recCumulativeLost,
recExtendedMax, recJitter, recRttMs));
EXPECT_EQ(0, ViE.rtp_rtcp->GetReceiveChannelRtcpStatistics(
tbChannel.videoChannel, received, recRttMs));
EXPECT_GT(recCumulativeLost, 0u);
EXPECT_GT(recExtendedMax, startSequenceNumber);
EXPECT_GT(recJitter, 0u);
EXPECT_GT(received.cumulative_lost, 0u);
EXPECT_GT(received.extended_max_sequence_number, startSequenceNumber);
EXPECT_GT(received.jitter, 0u);
EXPECT_GT(recRttMs, 0);
unsigned int estimated_bandwidth = 0;
@ -351,7 +342,8 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
}
// Check that rec stats extended max is greater than what we've sent.
EXPECT_GE(recExtendedMax, sentExtendedMax);
EXPECT_GE(received.extended_max_sequence_number,
sent.extended_max_sequence_number);
EXPECT_EQ(0, ViE.base->StopSend(tbChannel.videoChannel));
//
@ -486,62 +478,51 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
EXPECT_EQ(0, ViE.rtp_rtcp->SetNACKStatus(tbChannel.videoChannel, true));
EXPECT_EQ(0, ViE.rtp_rtcp->SetTransmissionSmoothingStatus(
tbChannel.videoChannel, true));
unsigned int bytes_sent_before = 0;
unsigned int packets_sent_before = 0;
unsigned int bytes_received_before = 0;
unsigned int packets_received_before = 0;
unsigned int bytes_sent_after = 0;
unsigned int packets_sent_after = 0;
unsigned int bytes_received_after = 0;
unsigned int packets_received_after = 0;
EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel,
bytes_sent_before,
packets_sent_before,
bytes_received_before,
packets_received_before));
webrtc::StreamDataCounters sent_before;
webrtc::StreamDataCounters received_before;
webrtc::StreamDataCounters sent_after;
webrtc::StreamDataCounters received_after;
EXPECT_EQ(0, ViE.rtp_rtcp->GetRtpStatistics(tbChannel.videoChannel,
sent_before,
received_before));
EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel));
EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel));
// Real-time mode.
AutoTestSleep(kAutoTestSleepTimeMs);
EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel,
bytes_sent_after,
packets_sent_after,
bytes_received_after,
packets_received_after));
EXPECT_EQ(0, ViE.rtp_rtcp->GetRtpStatistics(tbChannel.videoChannel,
sent_after, received_after));
if (FLAGS_include_timing_dependent_tests) {
EXPECT_GT(bytes_received_after, bytes_received_before);
EXPECT_GT(received_after.bytes, received_before.bytes);
}
// Simulate lost reception and verify that nothing is sent during that time.
ViE.network->SetNetworkTransmissionState(tbChannel.videoChannel, false);
// Allow the encoder to finish the current frame before we expect that no
// additional packets will be sent.
AutoTestSleep(kAutoTestSleepTimeMs);
bytes_received_before = bytes_received_after;
received_before.bytes = received_after.bytes;
ViETest::Log("Network Down...\n");
AutoTestSleep(kAutoTestSleepTimeMs);
EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel,
bytes_sent_after,
packets_sent_after,
bytes_received_after,
packets_received_after));
EXPECT_EQ(0, ViE.rtp_rtcp->GetRtpStatistics(tbChannel.videoChannel,
sent_before,
received_before));
if (FLAGS_include_timing_dependent_tests) {
EXPECT_EQ(bytes_received_before, bytes_received_after);
EXPECT_EQ(received_before.bytes, received_after.bytes);
}
// Network reception back. Video should now be sent.
ViE.network->SetNetworkTransmissionState(tbChannel.videoChannel, true);
ViETest::Log("Network Up...\n");
AutoTestSleep(kAutoTestSleepTimeMs);
EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel,
bytes_sent_before,
packets_sent_before,
bytes_received_before,
packets_received_before));
EXPECT_EQ(0, ViE.rtp_rtcp->GetRtpStatistics(tbChannel.videoChannel,
sent_before,
received_before));
if (FLAGS_include_timing_dependent_tests) {
EXPECT_GT(bytes_received_before, bytes_received_after);
EXPECT_GT(received_before.bytes, received_after.bytes);
}
bytes_received_after = bytes_received_before;
received_after.bytes = received_before.bytes;
// Buffering mode.
EXPECT_EQ(0, ViE.base->StopSend(tbChannel.videoChannel));
EXPECT_EQ(0, ViE.base->StopReceive(tbChannel.videoChannel));
@ -561,35 +542,29 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
// Allow the encoder to finish the current frame before we expect that no
// additional packets will be sent.
AutoTestSleep(kAutoTestSleepTimeMs);
EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel,
bytes_sent_before,
packets_sent_before,
bytes_received_before,
packets_received_before));
EXPECT_EQ(0, ViE.rtp_rtcp->GetRtpStatistics(tbChannel.videoChannel,
sent_before,
received_before));
if (FLAGS_include_timing_dependent_tests) {
EXPECT_GT(bytes_received_before, bytes_received_after);
EXPECT_GT(received_before.bytes, received_after.bytes);
}
bytes_received_after = bytes_received_before;
received_after.bytes = received_before.bytes;
AutoTestSleep(kAutoTestSleepTimeMs);
EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel,
bytes_sent_after,
packets_sent_after,
bytes_received_after,
packets_received_after));
EXPECT_EQ(0, ViE.rtp_rtcp->GetRtpStatistics(tbChannel.videoChannel,
sent_before,
received_before));
if (FLAGS_include_timing_dependent_tests) {
EXPECT_EQ(bytes_received_after, bytes_received_before);
EXPECT_EQ(received_after.bytes, received_before.bytes);
}
// Network reception back. Video should now be sent.
ViETest::Log("Network Up...\n");
ViE.network->SetNetworkTransmissionState(tbChannel.videoChannel, true);
AutoTestSleep(kAutoTestSleepTimeMs);
EXPECT_EQ(0, ViE.rtp_rtcp->GetRTPStatistics(tbChannel.videoChannel,
bytes_sent_before,
packets_sent_before,
bytes_received_before,
packets_received_before));
EXPECT_EQ(0, ViE.rtp_rtcp->GetRtpStatistics(tbChannel.videoChannel,
sent_before,
received_before));
if (FLAGS_include_timing_dependent_tests) {
EXPECT_GT(bytes_received_before, bytes_received_after);
EXPECT_GT(received_before.bytes, received_after.bytes);
}
// TODO(holmer): Verify that the decoded framerate doesn't decrease on an
// outage when in buffering mode. This isn't currently possible because we

View File

@ -45,7 +45,6 @@ class ViERenderImpl
const bool mirror_yaxis);
virtual int AddRenderer(const int render_id, RawVideoType video_input_format,
ExternalRenderer* renderer);
virtual int AddRenderCallback(int render_id,
VideoRenderCallback* callback) OVERRIDE;

View File

@ -823,11 +823,8 @@ int ViERTP_RTCPImpl::SetTransmissionSmoothingStatus(int video_channel,
return 0;
}
int ViERTP_RTCPImpl::GetReceivedRTCPStatistics(const int video_channel,
uint16_t& fraction_lost,
unsigned int& cumulative_lost,
unsigned int& extended_max,
unsigned int& jitter,
int ViERTP_RTCPImpl::GetReceiveChannelRtcpStatistics(const int video_channel,
RtcpStatistics& basic_stats,
int& rtt_ms) const {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
@ -841,22 +838,22 @@ int ViERTP_RTCPImpl::GetReceivedRTCPStatistics(const int video_channel,
shared_data_->SetLastError(kViERtpRtcpInvalidChannelId);
return -1;
}
if (vie_channel->GetReceivedRtcpStatistics(&fraction_lost,
&cumulative_lost,
&extended_max,
&jitter,
&rtt_ms) != 0) {
// TODO(sprang): Clean this up when stats struct is propagated all the way.
uint16_t frac_loss;
if (vie_channel->GetReceivedRtcpStatistics(
&frac_loss, &basic_stats.cumulative_lost,
&basic_stats.extended_max_sequence_number, &basic_stats.jitter,
&rtt_ms) != 0) {
basic_stats.fraction_lost = frac_loss;
shared_data_->SetLastError(kViERtpRtcpUnknownError);
return -1;
}
return 0;
}
int ViERTP_RTCPImpl::GetSentRTCPStatistics(const int video_channel,
uint16_t& fraction_lost,
unsigned int& cumulative_lost,
unsigned int& extended_max,
unsigned int& jitter,
int ViERTP_RTCPImpl::GetSendChannelRtcpStatistics(const int video_channel,
RtcpStatistics& basic_stats,
int& rtt_ms) const {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
@ -871,20 +868,22 @@ int ViERTP_RTCPImpl::GetSentRTCPStatistics(const int video_channel,
return -1;
}
if (vie_channel->GetSendRtcpStatistics(&fraction_lost, &cumulative_lost,
&extended_max, &jitter,
&rtt_ms) != 0) {
// TODO(sprang): Clean this up when stats struct is propagated all the way.
uint16_t frac_loss;
if (vie_channel->GetSendRtcpStatistics(
&frac_loss, &basic_stats.cumulative_lost,
&basic_stats.extended_max_sequence_number, &basic_stats.jitter,
&rtt_ms) != 0) {
basic_stats.fraction_lost = frac_loss;
shared_data_->SetLastError(kViERtpRtcpUnknownError);
return -1;
}
return 0;
}
int ViERTP_RTCPImpl::GetRTPStatistics(const int video_channel,
unsigned int& bytes_sent,
unsigned int& packets_sent,
unsigned int& bytes_received,
unsigned int& packets_received) const {
int ViERTP_RTCPImpl::GetRtpStatistics(const int video_channel,
StreamDataCounters& sent,
StreamDataCounters& received) const {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d)", __FUNCTION__, video_channel);
@ -897,10 +896,10 @@ int ViERTP_RTCPImpl::GetRTPStatistics(const int video_channel,
shared_data_->SetLastError(kViERtpRtcpInvalidChannelId);
return -1;
}
if (vie_channel->GetRtpStatistics(&bytes_sent,
&packets_sent,
&bytes_received,
&packets_received) != 0) {
if (vie_channel->GetRtpStatistics(&sent.bytes,
&sent.packets,
&received.bytes,
&received.packets) != 0) {
shared_data_->SetLastError(kViERtpRtcpUnknownError);
return -1;
}
@ -1100,4 +1099,76 @@ int ViERTP_RTCPImpl::DeregisterRTCPObserver(const int video_channel) {
return 0;
}
int ViERTP_RTCPImpl::RegisterSendChannelRtcpStatisticsCallback(
int channel, RtcpStatisticsCallback* callback) {
// TODO(sprang): Implement
return -1;
}
int ViERTP_RTCPImpl::DeregisterSendChannelRtcpStatisticsCallback(
int channel, RtcpStatisticsCallback* callback) {
// TODO(sprang): Implement
return -1;
}
int ViERTP_RTCPImpl::RegisterReceiveChannelRtcpStatisticsCallback(
int channel, RtcpStatisticsCallback* callback) {
// TODO(sprang): Implement
return -1;
}
int ViERTP_RTCPImpl::DeregisterReceiveChannelRtcpStatisticsCallback(
int channel, RtcpStatisticsCallback* callback) {
// TODO(sprang): Implement
return -1;
}
int ViERTP_RTCPImpl::RegisterSendChannelRtpStatisticsCallback(
int channel, StreamDataCountersCallback* callback) {
// TODO(sprang): Implement
return -1;
}
int ViERTP_RTCPImpl::DeregisterSendChannelRtpStatisticsCallback(
int channel, StreamDataCountersCallback* callback) {
// TODO(sprang): Implement
return -1;
}
int ViERTP_RTCPImpl::RegisterReceiveChannelRtpStatisticsCallback(
int channel, StreamDataCountersCallback* callback) {
// TODO(sprang): Implement
return -1;
}
int ViERTP_RTCPImpl::DeregisterReceiveChannelRtpStatisticsCallback(
int channel, StreamDataCountersCallback* callback) {
// TODO(sprang): Implement
return -1;
}
int ViERTP_RTCPImpl::RegisterSendBitrateObserver(
int channel, BitrateStatisticsObserver* callback) {
// TODO(sprang): Implement
return -1;
}
int ViERTP_RTCPImpl::DeregisterSendBitrateObserver(
int channel, BitrateStatisticsObserver* callback) {
// TODO(sprang): Implement
return -1;
}
int ViERTP_RTCPImpl::RegisterSendFrameCountObserver(
int channel, FrameCountObserver* callback) {
// TODO(sprang): Implement
return -1;
}
int ViERTP_RTCPImpl::DeregisterSendFrameCountObserver(
int channel, FrameCountObserver* callback) {
// TODO(sprang): Implement
return -1;
}
} // namespace webrtc

View File

@ -89,22 +89,15 @@ class ViERTP_RTCPImpl
bool enable,
int id);
virtual int SetTransmissionSmoothingStatus(int video_channel, bool enable);
virtual int GetReceivedRTCPStatistics(const int video_channel,
uint16_t& fraction_lost,
unsigned int& cumulative_lost,
unsigned int& extended_max,
unsigned int& jitter,
int& rtt_ms) const;
virtual int GetSentRTCPStatistics(const int video_channel,
uint16_t& fraction_lost,
unsigned int& cumulative_lost,
unsigned int& extended_max,
unsigned int& jitter, int& rtt_ms) const;
virtual int GetRTPStatistics(const int video_channel,
unsigned int& bytes_sent,
unsigned int& packets_sent,
unsigned int& bytes_received,
unsigned int& packets_received) const;
virtual int GetReceiveChannelRtcpStatistics(const int video_channel,
RtcpStatistics& basic_stats,
int& rtt_ms) const;
virtual int GetSendChannelRtcpStatistics(const int video_channel,
RtcpStatistics& basic_stats,
int& rtt_ms) const;
virtual int GetRtpStatistics(const int video_channel,
StreamDataCounters& sent,
StreamDataCounters& received) const;
virtual int GetBandwidthUsage(const int video_channel,
unsigned int& total_bitrate_sent,
unsigned int& video_bitrate_sent,
@ -127,6 +120,31 @@ class ViERTP_RTCPImpl
ViERTCPObserver& observer);
virtual int DeregisterRTCPObserver(const int video_channel);
virtual int RegisterSendChannelRtcpStatisticsCallback(
int channel, RtcpStatisticsCallback* callback);
virtual int DeregisterSendChannelRtcpStatisticsCallback(
int channel, RtcpStatisticsCallback* callback);
virtual int RegisterReceiveChannelRtcpStatisticsCallback(
int channel, RtcpStatisticsCallback* callback);
virtual int DeregisterReceiveChannelRtcpStatisticsCallback(
int channel, RtcpStatisticsCallback* callback);
virtual int RegisterSendChannelRtpStatisticsCallback(
int channel, StreamDataCountersCallback* callback);
virtual int DeregisterSendChannelRtpStatisticsCallback(
int channel, StreamDataCountersCallback* callback);
virtual int RegisterReceiveChannelRtpStatisticsCallback(
int channel, StreamDataCountersCallback* callback);
virtual int DeregisterReceiveChannelRtpStatisticsCallback(
int channel, StreamDataCountersCallback* callback);
virtual int RegisterSendBitrateObserver(
int channel, BitrateStatisticsObserver* callback);
virtual int DeregisterSendBitrateObserver(
int channel, BitrateStatisticsObserver* callback);
virtual int RegisterSendFrameCountObserver(
int channel, FrameCountObserver* callback);
virtual int DeregisterSendFrameCountObserver(
int channel, FrameCountObserver* callback);
protected:
explicit ViERTP_RTCPImpl(ViESharedData* shared_data);
virtual ~ViERTP_RTCPImpl();