Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1710)

Unified Diff: media/cast/receiver/frame_receiver.cc

Issue 387933005: Cast: Refactor RTCP handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: smaller diff Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/cast/receiver/frame_receiver.cc
diff --git a/media/cast/receiver/frame_receiver.cc b/media/cast/receiver/frame_receiver.cc
index 951e958b80efce9078943d212ada81c712f79282..fec489e87710ee81f55f29b2a25c132f679f690d 100644
--- a/media/cast/receiver/frame_receiver.cc
+++ b/media/cast/receiver/frame_receiver.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "media/cast/cast_environment.h"
+#include "media/cast/net/rtcp/rtcp_receiver.h"
namespace {
const int kMinSchedulingDelayMs = 1;
@@ -40,24 +41,21 @@ FrameReceiver::FrameReceiver(
config.incoming_ssrc,
true,
config.rtp_max_delay_ms * config.max_frame_rate / 1000),
- rtcp_(cast_environment_,
- NULL,
- NULL,
+ rtcp_(RtcpCastMessageCallback(),
+ RtcpRttCallback(),
+ RtcpLogMessageCallback(),
+ cast_environment_->Clock(),
packet_sender,
- &stats_,
- config.rtcp_mode,
- base::TimeDelta::FromMilliseconds(config.rtcp_interval),
config.feedback_ssrc,
config.incoming_ssrc,
- config.rtcp_c_name,
- event_media_type),
+ config.rtcp_c_name),
is_waiting_for_consecutive_frame_(false),
lip_sync_drift_(ClockDriftSmoother::GetDefaultTimeConstant()),
+ rtcp_interval_(base::TimeDelta::FromMilliseconds(config.rtcp_interval)),
weak_factory_(this) {
DCHECK_GT(config.rtp_max_delay_ms, 0);
DCHECK_GT(config.max_frame_rate, 0);
decryptor_.Initialize(config.aes_key, config.aes_iv_mask);
- rtcp_.SetTargetDelay(target_playout_delay_);
cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_);
memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_));
}
@@ -77,7 +75,7 @@ void FrameReceiver::RequestEncodedFrame(
bool FrameReceiver::ProcessPacket(scoped_ptr<Packet> packet) {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
- if (Rtcp::IsRtcpPacket(&packet->front(), packet->size())) {
+ if (RtcpReceiver::IsRtcpPacket(&packet->front(), packet->size())) {
rtcp_.IncomingRtcpPacket(&packet->front(), packet->size());
} else {
RtpCastHeader rtp_header;
@@ -183,7 +181,8 @@ void FrameReceiver::CastFeedback(const RtcpCastMessage& cast_message) {
ReceiverRtcpEventSubscriber::RtcpEventMultiMap rtcp_events;
event_subscriber_.GetRtcpEventsAndReset(&rtcp_events);
- rtcp_.SendRtcpFromRtpReceiver(&cast_message, &rtcp_events);
+ rtcp_.SendRtcpFromRtpReceiver(&cast_message, target_playout_delay_,
+ &rtcp_events, NULL);
}
void FrameReceiver::EmitAvailableEncodedFrames() {
@@ -302,9 +301,7 @@ void FrameReceiver::SendNextCastMessage() {
void FrameReceiver::ScheduleNextRtcpReport() {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
- base::TimeDelta time_to_next = rtcp_.TimeToSendNextRtcpReport() -
- cast_environment_->Clock()->NowTicks();
-
+ base::TimeDelta time_to_next = rtcp_interval_;
time_to_next = std::max(
time_to_next, base::TimeDelta::FromMilliseconds(kMinSchedulingDelayMs));
@@ -318,7 +315,7 @@ void FrameReceiver::ScheduleNextRtcpReport() {
void FrameReceiver::SendNextRtcpReport() {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
- rtcp_.SendRtcpFromRtpReceiver(NULL, NULL);
+ rtcp_.SendRtcpFromRtpReceiver(NULL, base::TimeDelta(), NULL, &stats_);
ScheduleNextRtcpReport();
}

Powered by Google App Engine
This is Rietveld 408576698