summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorandresp@webrtc.org <andresp@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-07-10 09:39:23 +0000
committerandresp@webrtc.org <andresp@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-07-10 09:39:23 +0000
commit8c95e83545433c8cd6f670ea6fe3e84293af3737 (patch)
treebcae22424180d74c1e6baa6835f81a5154acc926 /modules
parentf8bddb4a17217a4cd8e92e4b322ee8df3327e1c6 (diff)
downloadwebrtc-8c95e83545433c8cd6f670ea6fe3e84293af3737.tar.gz
Refactor registerable callbacks for FrameCountObserver from rtp_rtcp module into vie_channel.
R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/16839004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@6649 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'modules')
-rw-r--r--modules/rtp_rtcp/interface/rtp_rtcp.h5
-rw-r--r--modules/rtp_rtcp/source/rtp_rtcp_impl.cc15
-rw-r--r--modules/rtp_rtcp/source/rtp_rtcp_impl.h4
-rw-r--r--modules/rtp_rtcp/source/rtp_sender.cc15
-rw-r--r--modules/rtp_rtcp/source/rtp_sender.h8
-rw-r--r--modules/rtp_rtcp/source/rtp_sender_unittest.cc15
6 files changed, 19 insertions, 43 deletions
diff --git a/modules/rtp_rtcp/interface/rtp_rtcp.h b/modules/rtp_rtcp/interface/rtp_rtcp.h
index 235ca849..34f4d3f1 100644
--- a/modules/rtp_rtcp/interface/rtp_rtcp.h
+++ b/modules/rtp_rtcp/interface/rtp_rtcp.h
@@ -68,6 +68,7 @@ class RtpRtcp : public Module {
RemoteBitrateEstimator* remote_bitrate_estimator;
PacedSender* paced_sender;
BitrateStatisticsObserver* send_bitrate_observer;
+ FrameCountObserver* send_frame_count_observer;
};
/*
@@ -340,10 +341,6 @@ class RtpRtcp : public Module {
virtual int TimeToSendPadding(int bytes) = 0;
- virtual void RegisterSendFrameCountObserver(
- FrameCountObserver* observer) = 0;
- virtual FrameCountObserver* GetSendFrameCountObserver() const = 0;
-
virtual bool GetSendSideDelay(int* avg_send_delay_ms,
int* max_send_delay_ms) const = 0;
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 855d51b7..a7f81c61 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -38,7 +38,8 @@ RtpRtcp::Configuration::Configuration()
audio_messages(NullObjectRtpAudioFeedback()),
remote_bitrate_estimator(NULL),
paced_sender(NULL),
- send_bitrate_observer(NULL) {
+ send_bitrate_observer(NULL),
+ send_frame_count_observer(NULL) {
}
RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) {
@@ -62,7 +63,8 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
configuration.outgoing_transport,
configuration.audio_messages,
configuration.paced_sender,
- configuration.send_bitrate_observer),
+ configuration.send_bitrate_observer,
+ configuration.send_frame_count_observer),
rtcp_sender_(configuration.id,
configuration.audio,
configuration.clock,
@@ -1350,15 +1352,6 @@ StreamDataCountersCallback*
return rtp_sender_.GetRtpStatisticsCallback();
}
-void ModuleRtpRtcpImpl::RegisterSendFrameCountObserver(
- FrameCountObserver* observer) {
- rtp_sender_.RegisterFrameCountObserver(observer);
-}
-
-FrameCountObserver* ModuleRtpRtcpImpl::GetSendFrameCountObserver() const {
- return rtp_sender_.GetFrameCountObserver();
-}
-
bool ModuleRtpRtcpImpl::IsDefaultModule() const {
CriticalSectionScoped cs(critical_section_module_ptrs_.get());
return !child_modules_.empty();
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index b65131fb..37a0fa46 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -373,10 +373,6 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
void OnRequestSendReport();
- virtual void RegisterSendFrameCountObserver(
- FrameCountObserver* observer) OVERRIDE;
- virtual FrameCountObserver* GetSendFrameCountObserver() const OVERRIDE;
-
protected:
void RegisterChildModule(RtpRtcp* module);
diff --git a/modules/rtp_rtcp/source/rtp_sender.cc b/modules/rtp_rtcp/source/rtp_sender.cc
index 858fc42a..c98d4981 100644
--- a/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/modules/rtp_rtcp/source/rtp_sender.cc
@@ -46,7 +46,8 @@ RTPSender::RTPSender(const int32_t id,
Transport* transport,
RtpAudioFeedback* audio_feedback,
PacedSender* paced_sender,
- BitrateStatisticsObserver* bitrate_callback)
+ BitrateStatisticsObserver* bitrate_callback,
+ FrameCountObserver* frame_count_observer)
: clock_(clock),
bitrate_sent_(clock, this),
id_(id),
@@ -71,9 +72,9 @@ RTPSender::RTPSender(const int32_t id,
packet_history_(clock),
// Statistics
statistics_crit_(CriticalSectionWrapper::CreateCriticalSection()),
- frame_count_observer_(NULL),
rtp_stats_callback_(NULL),
bitrate_callback_(bitrate_callback),
+ frame_count_observer_(frame_count_observer),
// RTP variables
start_timestamp_forced_(false),
start_timestamp_(0),
@@ -1664,16 +1665,6 @@ void RTPSender::BuildRtxPacket(uint8_t* buffer, uint16_t* length,
*length += 2;
}
-void RTPSender::RegisterFrameCountObserver(FrameCountObserver* observer) {
- CriticalSectionScoped cs(statistics_crit_.get());
- frame_count_observer_ = observer;
-}
-
-FrameCountObserver* RTPSender::GetFrameCountObserver() const {
- CriticalSectionScoped cs(statistics_crit_.get());
- return frame_count_observer_;
-}
-
void RTPSender::RegisterRtpStatisticsCallback(
StreamDataCountersCallback* callback) {
CriticalSectionScoped cs(statistics_crit_.get());
diff --git a/modules/rtp_rtcp/source/rtp_sender.h b/modules/rtp_rtcp/source/rtp_sender.h
index 0cc35cf4..265e69c3 100644
--- a/modules/rtp_rtcp/source/rtp_sender.h
+++ b/modules/rtp_rtcp/source/rtp_sender.h
@@ -70,7 +70,8 @@ class RTPSender : public RTPSenderInterface, public Bitrate::Observer {
RTPSender(const int32_t id, const bool audio, Clock *clock,
Transport *transport, RtpAudioFeedback *audio_feedback,
PacedSender *paced_sender,
- BitrateStatisticsObserver* bitrate_callback);
+ BitrateStatisticsObserver* bitrate_callback,
+ FrameCountObserver* frame_count_observer);
virtual ~RTPSender();
void ProcessBitrate();
@@ -265,9 +266,6 @@ class RTPSender : public RTPSenderInterface, public Bitrate::Observer {
int32_t SetFecParameters(const FecProtectionParams *delta_params,
const FecProtectionParams *key_params);
- virtual void RegisterFrameCountObserver(FrameCountObserver* observer);
- virtual FrameCountObserver* GetFrameCountObserver() const;
-
int SendPadData(int payload_type, uint32_t timestamp, int64_t capture_time_ms,
int32_t bytes, StorageType store,
bool force_full_size_packets, bool only_pad_after_markerbit);
@@ -373,11 +371,11 @@ class RTPSender : public RTPSenderInterface, public Bitrate::Observer {
scoped_ptr<CriticalSectionWrapper> statistics_crit_;
SendDelayMap send_delays_ GUARDED_BY(statistics_crit_);
std::map<FrameType, uint32_t> frame_counts_ GUARDED_BY(statistics_crit_);
- FrameCountObserver* frame_count_observer_ GUARDED_BY(statistics_crit_);
StreamDataCounters rtp_stats_ GUARDED_BY(statistics_crit_);
StreamDataCounters rtx_rtp_stats_ GUARDED_BY(statistics_crit_);
StreamDataCountersCallback* rtp_stats_callback_ GUARDED_BY(statistics_crit_);
BitrateStatisticsObserver* const bitrate_callback_;
+ FrameCountObserver* const frame_count_observer_;
// RTP variables
bool start_timestamp_forced_ GUARDED_BY(send_critsect_);
diff --git a/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/modules/rtp_rtcp/source/rtp_sender_unittest.cc
index e08aa202..42ee023e 100644
--- a/modules/rtp_rtcp/source/rtp_sender_unittest.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_unittest.cc
@@ -94,7 +94,7 @@ class RtpSenderTest : public ::testing::Test {
virtual void SetUp() {
rtp_sender_.reset(new RTPSender(0, false, &fake_clock_, &transport_, NULL,
- &mock_paced_sender_, NULL));
+ &mock_paced_sender_, NULL, NULL));
rtp_sender_->SetSequenceNumber(kSeqNum);
}
@@ -672,7 +672,7 @@ TEST_F(RtpSenderTest, SendPadding) {
TEST_F(RtpSenderTest, SendRedundantPayloads) {
MockTransport transport;
rtp_sender_.reset(new RTPSender(0, false, &fake_clock_, &transport, NULL,
- &mock_paced_sender_, NULL));
+ &mock_paced_sender_, NULL, NULL));
rtp_sender_->SetSequenceNumber(kSeqNum);
// Make all packets go through the pacer.
EXPECT_CALL(mock_paced_sender_,
@@ -817,6 +817,9 @@ TEST_F(RtpSenderTest, FrameCountCallbacks) {
uint32_t delta_frames_;
} callback;
+ rtp_sender_.reset(new RTPSender(0, false, &fake_clock_, &transport_, NULL,
+ &mock_paced_sender_, NULL, &callback));
+
char payload_name[RTP_PAYLOAD_NAME_SIZE] = "GENERIC";
const uint8_t payload_type = 127;
ASSERT_EQ(0, rtp_sender_->RegisterPayload(payload_name, payload_type, 90000,
@@ -825,8 +828,6 @@ TEST_F(RtpSenderTest, FrameCountCallbacks) {
rtp_sender_->SetStorePacketsStatus(true, 1);
uint32_t ssrc = rtp_sender_->SSRC();
- rtp_sender_->RegisterFrameCountObserver(&callback);
-
ASSERT_EQ(0, rtp_sender_->SendOutgoingData(kVideoFrameKey, payload_type, 1234,
4321, payload, sizeof(payload),
NULL));
@@ -845,7 +846,7 @@ TEST_F(RtpSenderTest, FrameCountCallbacks) {
EXPECT_EQ(1U, callback.key_frames_);
EXPECT_EQ(1U, callback.delta_frames_);
- rtp_sender_->RegisterFrameCountObserver(NULL);
+ rtp_sender_.reset();
}
TEST_F(RtpSenderTest, BitrateCallbacks) {
@@ -866,7 +867,7 @@ TEST_F(RtpSenderTest, BitrateCallbacks) {
BitrateStatistics bitrate_;
} callback;
rtp_sender_.reset(new RTPSender(0, false, &fake_clock_, &transport_, NULL,
- &mock_paced_sender_, &callback));
+ &mock_paced_sender_, &callback, NULL));
// Simulate kNumPackets sent with kPacketInterval ms intervals.
const uint32_t kNumPackets = 15;
@@ -922,7 +923,7 @@ class RtpSenderAudioTest : public RtpSenderTest {
virtual void SetUp() {
payload_ = kAudioPayload;
rtp_sender_.reset(new RTPSender(0, true, &fake_clock_, &transport_, NULL,
- &mock_paced_sender_, NULL));
+ &mock_paced_sender_, NULL, NULL));
rtp_sender_->SetSequenceNumber(kSeqNum);
}
};