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

Unified Diff: remoting/client/audio_player.cc

Issue 2384063004: Move audio decoding to protocol layer (Closed)
Patch Set: Created 4 years, 2 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: remoting/client/audio_player.cc
diff --git a/remoting/client/audio_player.cc b/remoting/client/audio_player.cc
index df4590f3f3d77faee76e417441a1835e4d8cee39..e213ca69c4e20744c5008f0457079bb4e4c89158 100644
--- a/remoting/client/audio_player.cc
+++ b/remoting/client/audio_player.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include <string>
+#include "base/callback_helpers.h"
#include "base/logging.h"
#include "base/stl_util.h"
@@ -19,12 +20,12 @@ AudioPlayer::AudioPlayer()
: sampling_rate_(AudioPacket::SAMPLING_RATE_INVALID),
start_failed_(false),
queued_bytes_(0),
- bytes_consumed_(0) {
-}
+ bytes_consumed_(0) {}
AudioPlayer::~AudioPlayer() {}
-void AudioPlayer::AddAudioPacket(std::unique_ptr<AudioPacket> packet) {
+void AudioPlayer::ProcessAudioPacket(std::unique_ptr<AudioPacket> packet,
+ const base::Closure& done) {
CHECK_EQ(1, packet->data_size());
DCHECK_EQ(AudioPacket::ENCODING_RAW, packet->encoding());
DCHECK_NE(AudioPacket::SAMPLING_RATE_INVALID, packet->sampling_rate());
@@ -32,6 +33,8 @@ void AudioPlayer::AddAudioPacket(std::unique_ptr<AudioPacket> packet) {
DCHECK_EQ(kChannels, static_cast<int>(packet->channels()));
DCHECK_EQ(packet->data(0).size() % (kChannels * kSampleSizeBytes), 0u);
+ base::ScopedClosureRunner done_runner(done);
+
// No-op if the Pepper player won't start.
if (start_failed_) {
return;

Powered by Google App Engine
This is Rietveld 408576698