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

Unified Diff: remoting/host/audio_scheduler.cc

Issue 10836017: Piping for audio encoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed some style issues Created 8 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: remoting/host/audio_scheduler.cc
diff --git a/remoting/host/audio_scheduler.cc b/remoting/host/audio_scheduler.cc
index bb4aeb6f40a2cc6a40e6d6ef040b524385a07539..5f41bbcdf53205770cc32d1a240d9942c3cd6a53 100644
--- a/remoting/host/audio_scheduler.cc
+++ b/remoting/host/audio_scheduler.cc
@@ -9,6 +9,8 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/single_thread_task_runner.h"
+#include "remoting/base/audio_capture_data.h"
+#include "remoting/base/audio_encoder.h"
#include "remoting/host/audio_capturer.h"
#include "remoting/proto/audio.pb.h"
#include "remoting/protocol/audio_stub.h"
@@ -19,10 +21,12 @@ AudioScheduler::AudioScheduler(
scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
AudioCapturer* audio_capturer,
+ scoped_ptr<AudioEncoder> audio_encoder,
protocol::AudioStub* audio_stub)
: capture_task_runner_(capture_task_runner),
network_task_runner_(network_task_runner),
audio_capturer_(audio_capturer),
+ audio_encoder_(audio_encoder.Pass()),
audio_stub_(audio_stub),
network_stopped_(false) {
DCHECK(capture_task_runner_);
@@ -57,7 +61,14 @@ void AudioScheduler::OnClientDisconnected() {
AudioScheduler::~AudioScheduler() {
}
-void AudioScheduler::NotifyAudioPacketCaptured(scoped_ptr<AudioPacket> packet) {
+void AudioScheduler::NotifyAudioSamplesCaptured(
+ scoped_ptr<AudioCaptureData> capture_data) {
+ audio_encoder_->Encode(
+ capture_data.Pass(),
+ base::Bind(&AudioScheduler::NotifyAudioPacketEncoded, this));
+}
+
+void AudioScheduler::NotifyAudioPacketEncoded(scoped_ptr<AudioPacket> packet) {
network_task_runner_->PostTask(
FROM_HERE, base::Bind(&AudioScheduler::DoSendAudioPacket,
this, base::Passed(packet.Pass())));
@@ -68,7 +79,7 @@ void AudioScheduler::DoStart() {
// TODO(kxing): Do something with the return value.
audio_capturer_->Start(
- base::Bind(&AudioScheduler::NotifyAudioPacketCaptured, this));
+ base::Bind(&AudioScheduler::NotifyAudioSamplesCaptured, this));
}
void AudioScheduler::DoSendAudioPacket(scoped_ptr<AudioPacket> packet) {

Powered by Google App Engine
This is Rietveld 408576698