diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-01 03:55:47 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-01 03:55:47 +0000 |
commit | efb972be249349859616dbd059531e58511d018b (patch) | |
tree | 430e28ffb4df293cf386ce2c472e0c67e4beb39f /remoting/host/audio_scheduler.h | |
parent | be08386dc77f9da68a1fdd7d03550f6eeb352aee (diff) | |
download | chromium_src-efb972be249349859616dbd059531e58511d018b.zip chromium_src-efb972be249349859616dbd059531e58511d018b.tar.gz chromium_src-efb972be249349859616dbd059531e58511d018b.tar.bz2 |
Use a separate thread for audio capturing and encoding.
Previously we were using the same thread for capturing video frames and
audio capturing and encoding. It seems suboptimal as we don't want to block
screen capturer on audio encoding.
BUG=123046,145891
Review URL: https://chromiumcodereview.appspot.com/10914029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/audio_scheduler.h')
-rw-r--r-- | remoting/host/audio_scheduler.h | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/remoting/host/audio_scheduler.h b/remoting/host/audio_scheduler.h index d82de21..89a5805 100644 --- a/remoting/host/audio_scheduler.h +++ b/remoting/host/audio_scheduler.h @@ -24,26 +24,18 @@ class AudioCapturer; class AudioEncoder; class AudioPacket; -// A class for controlling AudioCapturer and forwarding audio packets to the -// client. -// -// THREADING -// -// This class works on two threads: the capture and network threads. -// Any encoding that is done on the audio samples will be done on the capture -// thread. -// -// AudioScheduler is responsible for: -// 1. managing the AudioCapturer. -// 2. sending packets of audio samples over the network to the client. +// AudioScheduler is responsible for fetching audio data from the AudioCapturer +// and encoding it before passing it to the AudioStub for delivery to the +// client. Audio is captured and encoded on the audio thread and then passed to +// AudioStub on the network thread. class AudioScheduler : public base::RefCountedThreadSafe<AudioScheduler> { public: - // Construct an AudioScheduler. TaskRunners are used for message passing - // among the capturer and network threads. The caller is responsible for - // ensuring that the |audio_capturer| and |audio_stub| outlive the - // AudioScheduler. + // Audio capture and encoding tasks are dispatched via the + // |audio_task_runner|. |audio_stub| tasks are dispatched via the + // |network_task_runner|. The caller must ensure that the |audio_capturer| and + // |audio_stub| exist until the scheduler is stopped using Stop() method. AudioScheduler( - scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, + scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, AudioCapturer* audio_capturer, scoped_ptr<AudioEncoder> audio_encoder, @@ -72,7 +64,7 @@ class AudioScheduler : public base::RefCountedThreadSafe<AudioScheduler> { // Called when an AudioPacket has been delivered to the client. void OnCaptureCallbackNotified(); - scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; + scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; AudioCapturer* audio_capturer_; |