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

Side by Side Diff: remoting/protocol/audio_decode_scheduler.h

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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_CLIENT_AUDIO_DECODE_SCHEDULER_H_ 5 #ifndef REMOTING_PROTOCOL_AUDIO_DECODE_SCHEDULER_H_
6 #define REMOTING_CLIENT_AUDIO_DECODE_SCHEDULER_H_ 6 #define REMOTING_PROTOCOL_AUDIO_DECODE_SCHEDULER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/threading/thread_checker.h"
13 #include "remoting/protocol/audio_stub.h" 14 #include "remoting/protocol/audio_stub.h"
14 15
15 namespace base { 16 namespace base {
16 class SingleThreadTaskRunner; 17 class SingleThreadTaskRunner;
17 } // namespace base 18 } // namespace base
18 19
19 namespace remoting { 20 namespace remoting {
20 21
21 namespace protocol {
22 class SessionConfig;
23 } // namespace protocol
24
25 class AudioConsumer;
26 class AudioDecoder; 22 class AudioDecoder;
27 class AudioPacket; 23 class AudioPacket;
28 24
29 class AudioDecodeScheduler : public protocol::AudioStub { 25 namespace protocol {
26
27 class SessionConfig;
28 class AudioStub;
29
30 class AudioDecodeScheduler : public AudioStub {
30 public: 31 public:
31 AudioDecodeScheduler( 32 AudioDecodeScheduler(
32 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
33 scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner, 33 scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner,
34 base::WeakPtr<AudioConsumer> audio_consumer); 34 base::WeakPtr<AudioStub> audio_consumer);
35 ~AudioDecodeScheduler() override; 35 ~AudioDecodeScheduler() override;
36 36
37 // Initializes decoder with the information from the protocol config. 37 // Initializes decoder with the information from the protocol config.
38 void Initialize(const protocol::SessionConfig& config); 38 void Initialize(const protocol::SessionConfig& config);
39 39
40 // AudioStub implementation. 40 // AudioStub implementation.
41 void ProcessAudioPacket(std::unique_ptr<AudioPacket> packet, 41 void ProcessAudioPacket(std::unique_ptr<AudioPacket> packet,
42 const base::Closure& done) override; 42 const base::Closure& done) override;
43 43
44 private: 44 private:
45 class Core; 45 void ProcessDecodedPacket(const base::Closure& done,
46 std::unique_ptr<AudioPacket> packet);
46 47
47 scoped_refptr<Core> core_; 48 scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner_;
49 base::WeakPtr<AudioStub> audio_consumer_;
50
51 // Decoder used on the audio thread.
52 std::unique_ptr<AudioDecoder> decoder_;
53
54 base::ThreadChecker thread_checker_;
55
56 base::WeakPtrFactory<AudioDecodeScheduler> weak_factory_;
48 57
49 DISALLOW_COPY_AND_ASSIGN(AudioDecodeScheduler); 58 DISALLOW_COPY_AND_ASSIGN(AudioDecodeScheduler);
50 }; 59 };
51 60
61 } // namespace protocol
52 } // namespace remoting 62 } // namespace remoting
53 63
54 #endif // REMOTING_CLIENT_AUDIO_DECODE_SCHEDULER_H_ 64 #endif // REMOTING_PROTOCOL_AUDIO_DECODE_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698