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

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

Issue 314593002: [Cast] Cleanup: Remove TransportXXXXXSender, an unnecessary layer of indirection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix CastTransportHostFilterTest.SimpleMessages. Created 6 years, 7 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/audio_sender/audio_sender.h ('k') | media/cast/cast.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/audio_sender/audio_sender.cc
diff --git a/media/cast/audio_sender/audio_sender.cc b/media/cast/audio_sender/audio_sender.cc
index a6e8cfe6de97438e2e2833da1d4707dc5dd199d4..f5183e957dae81f098d3ff04af7fd53d83c824cd 100644
--- a/media/cast/audio_sender/audio_sender.cc
+++ b/media/cast/audio_sender/audio_sender.cc
@@ -35,7 +35,7 @@ AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
audio_config.rtcp_c_name,
AUDIO_EVENT),
num_aggressive_rtcp_reports_sent_(0),
- cast_initialization_cb_(STATUS_AUDIO_UNINITIALIZED),
+ cast_initialization_status_(STATUS_AUDIO_UNINITIALIZED),
weak_factory_(this) {
rtcp_.SetCastReceiverEventHistorySize(kReceiverRtcpEventHistorySize);
if (!audio_config.use_external_encoder) {
@@ -44,7 +44,10 @@ AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
audio_config,
base::Bind(&AudioSender::SendEncodedAudioFrame,
weak_factory_.GetWeakPtr())));
- cast_initialization_cb_ = audio_encoder_->InitializationResult();
+ cast_initialization_status_ = audio_encoder_->InitializationResult();
+ } else {
+ NOTREACHED(); // No support for external audio encoding.
+ cast_initialization_status_ = STATUS_AUDIO_INITIALIZED;
}
media::cast::transport::CastTransportAudioConfig transport_config;
@@ -64,6 +67,10 @@ AudioSender::~AudioSender() {}
void AudioSender::InsertAudio(scoped_ptr<AudioBus> audio_bus,
const base::TimeTicks& recorded_time) {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
+ if (cast_initialization_status_ != STATUS_AUDIO_INITIALIZED) {
+ NOTREACHED();
+ return;
+ }
DCHECK(audio_encoder_.get()) << "Invalid internal state";
audio_encoder_->InsertAudio(audio_bus.Pass(), recorded_time);
}
@@ -71,6 +78,7 @@ void AudioSender::InsertAudio(scoped_ptr<AudioBus> audio_bus,
void AudioSender::SendEncodedAudioFrame(
scoped_ptr<transport::EncodedFrame> audio_frame) {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
+
DCHECK(!audio_frame->reference_time.is_null());
rtp_timestamp_helper_.StoreLatestTime(audio_frame->reference_time,
audio_frame->rtp_timestamp);
« no previous file with comments | « media/cast/audio_sender/audio_sender.h ('k') | media/cast/cast.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698