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

Unified Diff: media/cast/sender/audio_sender.cc

Issue 514263002: Move common code and variables from audio/video sender to frame sender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « media/cast/sender/audio_sender.h ('k') | media/cast/sender/frame_sender.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/sender/audio_sender.cc
diff --git a/media/cast/sender/audio_sender.cc b/media/cast/sender/audio_sender.cc
index 4bf93b30cd615ce90f4b061070fcb2955283af8e..040bc62be94bed12056f6c0f7d5c80d5e47b10e2 100644
--- a/media/cast/sender/audio_sender.cc
+++ b/media/cast/sender/audio_sender.cc
@@ -16,7 +16,6 @@ namespace cast {
namespace {
const int kNumAggressiveReportsSentAtStart = 100;
-const int kMinSchedulingDelayMs = 1;
// TODO(miu): This should be specified in AudioSenderConfig, but currently it is
// fixed to 100 FPS (i.e., 10 ms per frame), and AudioEncoder assumes this as
@@ -37,12 +36,8 @@ AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
kAudioFrameRate * 2.0, // We lie to increase max outstanding frames.
audio_config.target_playout_delay),
configured_encoder_bitrate_(audio_config.bitrate),
- num_aggressive_rtcp_reports_sent_(0),
- last_sent_frame_id_(0),
- latest_acked_frame_id_(0),
- duplicate_ack_counter_(0),
- cast_initialization_status_(STATUS_AUDIO_UNINITIALIZED),
weak_factory_(this) {
+ cast_initialization_status_ = STATUS_AUDIO_UNINITIALIZED;
VLOG(1) << "max_unacked_frames " << max_unacked_frames_;
DCHECK_GT(max_unacked_frames_, 0);
@@ -76,7 +71,6 @@ AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
base::Bind(&AudioSender::OnReceivedCastFeedback,
weak_factory_.GetWeakPtr()),
base::Bind(&AudioSender::OnReceivedRtt, weak_factory_.GetWeakPtr()));
- memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_));
}
AudioSender::~AudioSender() {}
@@ -149,37 +143,6 @@ void AudioSender::SendEncodedAudioFrame(
transport_sender_->InsertCodedAudioFrame(*encoded_frame);
}
-void AudioSender::ScheduleNextResendCheck() {
- DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
- DCHECK(!last_send_time_.is_null());
- base::TimeDelta time_to_next =
- last_send_time_ - cast_environment_->Clock()->NowTicks() +
- target_playout_delay_;
- time_to_next = std::max(
- time_to_next, base::TimeDelta::FromMilliseconds(kMinSchedulingDelayMs));
- cast_environment_->PostDelayedTask(
- CastEnvironment::MAIN,
- FROM_HERE,
- base::Bind(&AudioSender::ResendCheck, weak_factory_.GetWeakPtr()),
- time_to_next);
-}
-
-void AudioSender::ResendCheck() {
- DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
- DCHECK(!last_send_time_.is_null());
- const base::TimeDelta time_since_last_send =
- cast_environment_->Clock()->NowTicks() - last_send_time_;
- if (time_since_last_send > target_playout_delay_) {
- if (latest_acked_frame_id_ == last_sent_frame_id_) {
- // Last frame acked, no point in doing anything
- } else {
- VLOG(1) << "ACK timeout; last acked frame: " << latest_acked_frame_id_;
- ResendForKickstart();
- }
- }
- ScheduleNextResendCheck();
-}
-
void AudioSender::OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback) {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
@@ -257,14 +220,5 @@ bool AudioSender::AreTooManyFramesInFlight() const {
return frames_in_flight >= max_unacked_frames_;
}
-void AudioSender::ResendForKickstart() {
- DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
- DCHECK(!last_send_time_.is_null());
- VLOG(1) << "Resending last packet of frame " << last_sent_frame_id_
- << " to kick-start.";
- last_send_time_ = cast_environment_->Clock()->NowTicks();
- transport_sender_->ResendFrameForKickstart(ssrc_, last_sent_frame_id_);
-}
-
} // namespace cast
} // namespace media
« no previous file with comments | « media/cast/sender/audio_sender.h ('k') | media/cast/sender/frame_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698