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

Unified Diff: media/cast/test/utility/in_process_receiver.cc

Issue 214273003: [Cast] Remove AudioDecoder's dependency on WebRTC, and refactor/clean-up AudioReceiver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One moar Windows compile fix. Created 6 years, 9 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/test/utility/in_process_receiver.cc
diff --git a/media/cast/test/utility/in_process_receiver.cc b/media/cast/test/utility/in_process_receiver.cc
index c8dfc285023e52ae1a470d24f6ad8951120df48d..a204e2128d8202b052c8f78e5ba9956e0fbf6932 100644
--- a/media/cast/test/utility/in_process_receiver.cc
+++ b/media/cast/test/utility/in_process_receiver.cc
@@ -77,11 +77,22 @@ void InProcessReceiver::StartOnMainThread() {
PullNextVideoFrame();
}
-void InProcessReceiver::GotAudioFrame(scoped_ptr<PcmAudioFrame> audio_frame,
- const base::TimeTicks& playout_time) {
+void InProcessReceiver::GotAudioFrame(scoped_ptr<AudioBus> audio_frame,
+ const base::TimeTicks& playout_time,
+ bool is_continuous) {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
- OnAudioFrame(audio_frame.Pass(), playout_time);
- // TODO(miu): Put this back here: PullNextAudioFrame();
+ if (audio_frame.get()) {
+ // TODO(miu): Remove use of deprecated PcmAudioFrame and also pass
+ // |is_continuous| flag.
+ scoped_ptr<PcmAudioFrame> pcm_frame(new PcmAudioFrame());
+ pcm_frame->channels = audio_frame->channels();
+ pcm_frame->frequency = audio_config_.frequency;
+ pcm_frame->samples.resize(audio_frame->channels() * audio_frame->frames());
+ audio_frame->ToInterleaved(
+ audio_frame->frames(), sizeof(int16), &pcm_frame->samples.front());
+ OnAudioFrame(pcm_frame.Pass(), playout_time);
+ }
+ PullNextAudioFrame();
}
void InProcessReceiver::GotVideoFrame(
@@ -95,20 +106,8 @@ void InProcessReceiver::GotVideoFrame(
void InProcessReceiver::PullNextAudioFrame() {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
cast_receiver_->frame_receiver()->GetRawAudioFrame(
- 1 /* 10 ms of samples */,
- audio_config_.frequency,
base::Bind(&InProcessReceiver::GotAudioFrame,
weak_factory_.GetWeakPtr()));
- // TODO(miu): Fix audio decoder so that it never drops a request for the next
- // frame of audio. Once fixed, remove this, and add PullNextAudioFrame() to
- // the end of GotAudioFrame(), so that it behaves just like GotVideoFrame().
- // http://crbug.com/347361
- cast_environment_->PostDelayedTask(
- CastEnvironment::MAIN,
- FROM_HERE,
- base::Bind(&InProcessReceiver::PullNextAudioFrame,
- weak_factory_.GetWeakPtr()),
- base::TimeDelta::FromMilliseconds(10));
}
void InProcessReceiver::PullNextVideoFrame() {
« no previous file with comments | « media/cast/test/utility/in_process_receiver.h ('k') | media/cast/test/utility/standalone_cast_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698