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

Unified Diff: remoting/host/audio_scheduler.cc

Issue 866863004: Replace AudioScheduler with AudioPump. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mouse_cursor_pipe
Patch Set: Created 5 years, 10 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 | « remoting/host/audio_scheduler.h ('k') | remoting/host/client_session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/audio_scheduler.cc
diff --git a/remoting/host/audio_scheduler.cc b/remoting/host/audio_scheduler.cc
deleted file mode 100644
index 6a48d47a50c69d6abf7dd3f3a486d3a9dd9b449f..0000000000000000000000000000000000000000
--- a/remoting/host/audio_scheduler.cc
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "remoting/host/audio_scheduler.h"
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/logging.h"
-#include "base/single_thread_task_runner.h"
-#include "remoting/codec/audio_encoder.h"
-#include "remoting/host/audio_capturer.h"
-#include "remoting/proto/audio.pb.h"
-#include "remoting/protocol/audio_stub.h"
-
-namespace remoting {
-
-AudioScheduler::AudioScheduler(
- scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
- scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
- scoped_ptr<AudioCapturer> audio_capturer,
- scoped_ptr<AudioEncoder> audio_encoder,
- protocol::AudioStub* audio_stub)
- : audio_task_runner_(audio_task_runner),
- network_task_runner_(network_task_runner),
- audio_capturer_(audio_capturer.Pass()),
- audio_encoder_(audio_encoder.Pass()),
- audio_stub_(audio_stub),
- enabled_(true) {
- DCHECK(network_task_runner_->BelongsToCurrentThread());
- DCHECK(audio_capturer_);
- DCHECK(audio_encoder_);
- DCHECK(audio_stub_);
-}
-
-void AudioScheduler::Start() {
- DCHECK(network_task_runner_->BelongsToCurrentThread());
-
- audio_task_runner_->PostTask(
- FROM_HERE, base::Bind(&AudioScheduler::StartOnAudioThread, this));
-}
-
-void AudioScheduler::Stop() {
- DCHECK(network_task_runner_->BelongsToCurrentThread());
- DCHECK(audio_stub_);
-
- // Clear |audio_stub_| to prevent audio packets being delivered to the client.
- audio_stub_ = nullptr;
-
- audio_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&AudioScheduler::StopOnAudioThread, this));
-}
-
-AudioScheduler::~AudioScheduler() {
-}
-
-void AudioScheduler::StartOnAudioThread() {
- DCHECK(audio_task_runner_->BelongsToCurrentThread());
-
- // TODO(kxing): Do something with the return value.
- audio_capturer_->Start(
- base::Bind(&AudioScheduler::EncodeAudioPacket, this));
-}
-
-void AudioScheduler::StopOnAudioThread() {
- DCHECK(audio_task_runner_->BelongsToCurrentThread());
- audio_capturer_->Stop();
-}
-
-void AudioScheduler::Pause(bool pause) {
- if (!audio_task_runner_->BelongsToCurrentThread()) {
- audio_task_runner_->PostTask(
- FROM_HERE, base::Bind(&AudioScheduler::Pause, this, pause));
- return;
- }
-
- enabled_ = !pause;
-}
-
-void AudioScheduler::EncodeAudioPacket(scoped_ptr<AudioPacket> packet) {
- DCHECK(audio_task_runner_->BelongsToCurrentThread());
- DCHECK(packet.get());
-
- if (!enabled_)
- return;
-
- scoped_ptr<AudioPacket> encoded_packet =
- audio_encoder_->Encode(packet.Pass());
-
- // The audio encoder returns a null audio packet if there's no audio to send.
- if (encoded_packet.get()) {
- network_task_runner_->PostTask(
- FROM_HERE, base::Bind(&AudioScheduler::SendAudioPacket,
- this, base::Passed(&encoded_packet)));
- }
-}
-
-void AudioScheduler::SendAudioPacket(scoped_ptr<AudioPacket> packet) {
- DCHECK(network_task_runner_->BelongsToCurrentThread());
- DCHECK(packet.get());
-
- if (!audio_stub_)
- return;
-
- audio_stub_->ProcessAudioPacket(packet.Pass(), base::Closure());
-}
-
-} // namespace remoting
« no previous file with comments | « remoting/host/audio_scheduler.h ('k') | remoting/host/client_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698