Report total bitrate for all streams in GetStats.

This regression wasn't caught because I accidentally disabled multiple
streams for EndToEndTest.GetStats in a refactoring.

R=stefan@webrtc.org, xians@webrtc.org
BUG=1667

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7701 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org
2014-11-14 11:52:04 +00:00
parent 35c1ace185
commit ece3890d3a
24 changed files with 22 additions and 470 deletions

View File

@ -69,25 +69,6 @@ class WEBRTC_DLLEXPORT ViERTPObserver {
virtual ~ViERTPObserver() {}
};
// This class declares an abstract interface for a user defined observer. It is
// up to the VideoEngine user to implement a derived class which implements the
// observer class. The observer is registered using RegisterRTCPObserver() and
// deregistered using DeregisterRTCPObserver().
class WEBRTC_DLLEXPORT ViERTCPObserver {
public:
// This method is called if a application-defined RTCP packet has been
// received.
virtual void OnApplicationDataReceived(
const int video_channel,
const unsigned char sub_type,
const unsigned int name,
const char* data,
const unsigned short data_length_in_bytes) = 0;
protected:
virtual ~ViERTCPObserver() {}
};
class WEBRTC_DLLEXPORT ViERTP_RTCP {
public:
enum { KDefaultDeltaTransmitTimeSeconds = 15 };
@ -468,13 +449,6 @@ class WEBRTC_DLLEXPORT ViERTP_RTCP {
// Removes a registered instance of ViERTPObserver.
virtual int DeregisterRTPObserver(const int video_channel) = 0;
// Registers an instance of a user implementation of the ViERTCPObserver.
virtual int RegisterRTCPObserver(const int video_channel,
ViERTCPObserver& observer) = 0;
// 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(
int video_channel, FrameCountObserver* observer) = 0;

View File

@ -52,9 +52,4 @@ TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest),
tests_->ViERenderExtendedTest();
}
TEST_F(DISABLED_ON_MAC(ViEExtendedIntegrationTest),
DISABLED_RunsRtpRtcpTestWithoutErrors) {
tests_->ViERtpRtcpExtendedTest();
}
} // namespace

View File

@ -100,7 +100,6 @@ public:
// vie_autotest_rtp_rtcp.cc
void ViERtpRtcpStandardTest();
void ViERtpRtcpExtendedTest();
void ViERtpRtcpAPITest();
private:

View File

@ -76,7 +76,6 @@ void ViEAutoTest::ViEExtendedTest()
ViECodecExtendedTest();
ViEImageProcessExtendedTest();
ViERenderExtendedTest();
ViERtpRtcpExtendedTest();
}
void ViEAutoTest::ViEAPITest()

View File

@ -150,7 +150,8 @@ int ViEAutoTestAndroid::RunAutotest(int testSelection, int subTestSelection,
break;
case 8: // RTP/RTCP
vieAutoTest.ViERtpRtcpExtendedTest();
// Note that this test is removed. It hasn't been properly cleaned up
// because this hopefully going away soon.
break;
default:

View File

@ -40,52 +40,6 @@ public:
}
};
class ViERtcpObserver: public webrtc::ViERTCPObserver
{
public:
int _channel;
unsigned char _subType;
unsigned int _name;
char* _data;
unsigned short _dataLength;
ViERtcpObserver() :
_channel(-1),
_subType(0),
_name(0),
_data(NULL),
_dataLength(0)
{
}
~ViERtcpObserver()
{
if (_data)
{
delete[] _data;
}
}
virtual void OnApplicationDataReceived(
const int videoChannel, const unsigned char subType,
const unsigned int name, const char* data,
const unsigned short dataLengthInBytes)
{
_channel = videoChannel;
_subType = subType;
_name = name;
if (dataLengthInBytes > _dataLength)
{
delete[] _data;
_data = NULL;
}
if (_data == NULL)
{
_data = new char[dataLengthInBytes];
}
memcpy(_data, data, dataLengthInBytes);
_dataLength = dataLengthInBytes;
}
};
void ViEAutoTest::ViERtpRtcpStandardTest()
{
// ***************************************************************
@ -630,70 +584,6 @@ void ViEAutoTest::ViERtpRtcpStandardTest()
//***************************************************************
}
void ViEAutoTest::ViERtpRtcpExtendedTest()
{
//***************************************************************
// Begin create/initialize WebRTC Video Engine for testing
//***************************************************************
// Create VIE
TbInterfaces ViE("ViERtpRtcpExtendedTest");
// Create a video channel
TbVideoChannel tbChannel(ViE, webrtc::kVideoCodecVP8);
// Create a capture device
TbCaptureDevice tbCapture(ViE);
tbCapture.ConnectTo(tbChannel.videoChannel);
//tbChannel.StartReceive(rtpPort);
//tbChannel.StartSend(rtpPort);
TbExternalTransport myTransport(*(ViE.network), tbChannel.videoChannel,
NULL);
EXPECT_EQ(0, ViE.network->DeregisterSendTransport(tbChannel.videoChannel));
EXPECT_EQ(0, ViE.network->RegisterSendTransport(
tbChannel.videoChannel, myTransport));
EXPECT_EQ(0, ViE.base->StartReceive(tbChannel.videoChannel));
EXPECT_EQ(0, ViE.base->StartSend(tbChannel.videoChannel));
//***************************************************************
// Engine ready. Begin testing class
//***************************************************************
//
// Application specific RTCP
//
//
ViERtcpObserver rtcpObserver;
EXPECT_EQ(0, ViE.rtp_rtcp->RegisterRTCPObserver(
tbChannel.videoChannel, rtcpObserver));
unsigned char subType = 3;
unsigned int name = static_cast<unsigned int> (0x41424344); // 'ABCD';
const char* data = "ViEAutoTest Data of length 32 -\0";
const unsigned short numBytes = 32;
EXPECT_EQ(0, ViE.rtp_rtcp->SendApplicationDefinedRTCPPacket(
tbChannel.videoChannel, subType, name, data, numBytes));
ViETest::Log("Sending RTCP application data...\n");
AutoTestSleep(kAutoTestSleepTimeMs);
EXPECT_EQ(subType, rtcpObserver._subType);
EXPECT_STRCASEEQ(data, rtcpObserver._data);
EXPECT_EQ(name, rtcpObserver._name);
EXPECT_EQ(numBytes, rtcpObserver._dataLength);
ViETest::Log("\t RTCP application data received\n");
//***************************************************************
// Testing finished. Tear down Video Engine
//***************************************************************
EXPECT_EQ(0, ViE.base->StopReceive(tbChannel.videoChannel));
EXPECT_EQ(0, ViE.base->StopSend(tbChannel.videoChannel));
EXPECT_EQ(0, ViE.network->DeregisterSendTransport(tbChannel.videoChannel));
}
void ViEAutoTest::ViERtpRtcpAPITest()
{
//***************************************************************
@ -853,16 +743,6 @@ void ViEAutoTest::ViERtpRtcpAPITest()
tbChannel.videoChannel));
EXPECT_NE(0, ViE.rtp_rtcp->DeregisterRTPObserver(
tbChannel.videoChannel));
ViERtcpObserver rtcpObserver;
EXPECT_EQ(0, ViE.rtp_rtcp->RegisterRTCPObserver(
tbChannel.videoChannel, rtcpObserver));
EXPECT_NE(0, ViE.rtp_rtcp->RegisterRTCPObserver(
tbChannel.videoChannel, rtcpObserver));
EXPECT_EQ(0, ViE.rtp_rtcp->DeregisterRTCPObserver(
tbChannel.videoChannel));
EXPECT_NE(0, ViE.rtp_rtcp->DeregisterRTCPObserver(
tbChannel.videoChannel));
}
//
// PLI

View File

@ -130,7 +130,6 @@ ViEChannel::ViEChannel(int32_t channel_id,
codec_observer_(NULL),
do_key_frame_callbackRequest_(false),
rtp_observer_(NULL),
rtcp_observer_(NULL),
intra_frame_observer_(intra_frame_observer),
rtt_stats_(rtt_stats),
paced_sender_(paced_sender),
@ -150,22 +149,9 @@ ViEChannel::ViEChannel(int32_t channel_id,
max_nack_reordering_threshold_(kMaxPacketAgeToNack),
pre_render_callback_(NULL),
start_ms_(Clock::GetRealTimeClock()->TimeInMilliseconds()) {
RtpRtcp::Configuration configuration;
configuration.id = ViEModuleId(engine_id, channel_id);
configuration.audio = false;
configuration.default_module = default_rtp_rtcp;
configuration.outgoing_transport = &vie_sender_;
configuration.rtcp_feedback = this;
configuration.intra_frame_callback = intra_frame_observer;
configuration.bandwidth_callback = bandwidth_observer;
configuration.rtt_stats = rtt_stats;
RtpRtcp::Configuration configuration = CreateRtpRtcpConfiguration();
configuration.remote_bitrate_estimator = remote_bitrate_estimator;
configuration.paced_sender = paced_sender;
configuration.receive_statistics = vie_receiver_.GetReceiveStatistics();
configuration.send_bitrate_observer = &send_bitrate_observer_;
configuration.send_frame_count_observer = &send_frame_count_observer_;
configuration.send_side_delay_observer = &send_side_delay_observer_;
rtp_rtcp_.reset(RtpRtcp::CreateRtpRtcp(configuration));
vie_receiver_.SetRtpRtcpModule(rtp_rtcp_.get());
vcm_->SetNackSettings(kMaxNackListSize, max_nack_reordering_threshold_, 0);
@ -1013,20 +999,6 @@ int32_t ViEChannel::RegisterRtpObserver(ViERTPObserver* observer) {
return 0;
}
int32_t ViEChannel::RegisterRtcpObserver(ViERTCPObserver* observer) {
CriticalSectionScoped cs(callback_cs_.get());
if (observer) {
if (rtcp_observer_) {
LOG_F(LS_ERROR) << "Observer already registered.";
return -1;
}
rtcp_observer_ = observer;
} else {
rtcp_observer_ = NULL;
}
return 0;
}
int32_t ViEChannel::SendApplicationDefinedRTCPPacket(
const uint8_t sub_type,
uint32_t name,
@ -1640,19 +1612,25 @@ RtpRtcp* ViEChannel::GetRtpRtcpModule(size_t index) const {
return *it;
}
RtpRtcp* ViEChannel::CreateRtpRtcpModule() {
RtpRtcp::Configuration ViEChannel::CreateRtpRtcpConfiguration() {
RtpRtcp::Configuration configuration;
configuration.id = ViEModuleId(engine_id_, channel_id_);
configuration.audio = false; // Video.
configuration.audio = false;
configuration.default_module = default_rtp_rtcp_;
configuration.outgoing_transport = &vie_sender_;
configuration.intra_frame_callback = intra_frame_observer_;
configuration.bandwidth_callback = bandwidth_observer_.get();
configuration.rtt_stats = rtt_stats_;
configuration.paced_sender = paced_sender_;
configuration.send_bitrate_observer = &send_bitrate_observer_;
configuration.send_frame_count_observer = &send_frame_count_observer_;
configuration.send_side_delay_observer = &send_side_delay_observer_;
return RtpRtcp::CreateRtpRtcp(configuration);
return configuration;
}
RtpRtcp* ViEChannel::CreateRtpRtcpModule() {
return RtpRtcp::CreateRtpRtcp(CreateRtpRtcpConfiguration());
}
int32_t ViEChannel::StartDecodeThread() {
@ -1732,24 +1710,6 @@ void ViEChannel::RegisterPreDecodeImageCallback(
vcm_->RegisterPreDecodeImageCallback(pre_decode_callback);
}
void ViEChannel::OnApplicationDataReceived(const int32_t id,
const uint8_t sub_type,
const uint32_t name,
const uint16_t length,
const uint8_t* data) {
if (channel_id_ != ChannelId(id)) {
return;
}
CriticalSectionScoped cs(callback_cs_.get());
{
if (rtcp_observer_) {
rtcp_observer_->OnApplicationDataReceived(
channel_id_, sub_type, name, reinterpret_cast<const char*>(data),
length);
}
}
}
int32_t ViEChannel::OnInitializeDecoder(
const int32_t id,
const int8_t payload_type,

View File

@ -14,6 +14,7 @@
#include <list>
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
#include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
@ -39,11 +40,9 @@ class I420FrameCallback;
class PacedSender;
class ProcessThread;
class RtcpRttStats;
class RtpRtcp;
class ThreadWrapper;
class ViEDecoderObserver;
class ViEEffectFilter;
class ViERTCPObserver;
class ViERTPObserver;
class VideoCodingModule;
class VideoDecoder;
@ -56,7 +55,6 @@ class ViEChannel
public VCMReceiveStatisticsCallback,
public VCMDecoderTimingCallback,
public VCMPacketRequestCallback,
public RtcpFeedback,
public RtpFeedback,
public ViEFrameProviderBase {
public:
@ -162,7 +160,6 @@ class ViEChannel
// Gets the CName of the incoming stream.
int32_t GetRemoteRTCPCName(char rtcp_cname[]);
int32_t RegisterRtpObserver(ViERTPObserver* observer);
int32_t RegisterRtcpObserver(ViERTCPObserver* observer);
int32_t SendApplicationDefinedRTCPPacket(
const uint8_t sub_type,
uint32_t name,
@ -226,13 +223,6 @@ class ViEChannel
RTPDirections direction);
int32_t StopRTPDump(RTPDirections direction);
// Implements RtcpFeedback.
// TODO(pwestin) Depricate this functionality.
virtual void OnApplicationDataReceived(const int32_t id,
const uint8_t sub_type,
const uint32_t name,
const uint16_t length,
const uint8_t* data);
// Implements RtpFeedback.
virtual int32_t OnInitializeDecoder(
const int32_t id,
@ -370,6 +360,7 @@ class ViEChannel
EXCLUSIVE_LOCKS_REQUIRED(rtp_rtcp_cs_);
RtpRtcp* GetRtpRtcpModule(size_t simulcast_idx) const
EXCLUSIVE_LOCKS_REQUIRED(rtp_rtcp_cs_);
RtpRtcp::Configuration CreateRtpRtcpConfiguration();
RtpRtcp* CreateRtpRtcpModule();
// Assumed to be protected.
int32_t StartDecodeThread();
@ -475,7 +466,6 @@ class ViEChannel
ViEDecoderObserver* codec_observer_;
bool do_key_frame_callbackRequest_;
ViERTPObserver* rtp_observer_;
ViERTCPObserver* rtcp_observer_;
RtcpIntraFrameObserver* intra_frame_observer_;
RtcpRttStats* rtt_stats_;
PacedSender* paced_sender_;

View File

@ -906,37 +906,6 @@ int ViERTP_RTCPImpl::DeregisterRTPObserver(const int video_channel) {
return 0;
}
int ViERTP_RTCPImpl::RegisterRTCPObserver(const int video_channel,
ViERTCPObserver& observer) {
LOG_F(LS_INFO) << "channel " << video_channel;
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_channel) {
shared_data_->SetLastError(kViERtpRtcpInvalidChannelId);
return -1;
}
if (vie_channel->RegisterRtcpObserver(&observer) != 0) {
shared_data_->SetLastError(kViERtpRtcpObserverAlreadyRegistered);
return -1;
}
return 0;
}
int ViERTP_RTCPImpl::DeregisterRTCPObserver(const int video_channel) {
LOG_F(LS_INFO) << "channel " << video_channel;
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_channel) {
shared_data_->SetLastError(kViERtpRtcpInvalidChannelId);
return -1;
}
if (vie_channel->RegisterRtcpObserver(NULL) != 0) {
shared_data_->SetLastError(kViERtpRtcpObserverNotRegistered);
return -1;
}
return 0;
}
int ViERTP_RTCPImpl::RegisterSendChannelRtcpStatisticsCallback(
int video_channel, RtcpStatisticsCallback* callback) {
LOG_F(LS_INFO) << "channel " << video_channel;

View File

@ -133,9 +133,6 @@ class ViERTP_RTCPImpl
virtual int RegisterRTPObserver(const int video_channel,
ViERTPObserver& observer);
virtual int DeregisterRTPObserver(const int video_channel);
virtual int RegisterRTCPObserver(const int video_channel,
ViERTCPObserver& observer);
virtual int DeregisterRTCPObserver(const int video_channel);
virtual int RegisterSendChannelRtcpStatisticsCallback(
int channel, RtcpStatisticsCallback* callback);