OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PLAYER_H_ | 5 #ifndef REMOTING_CLIENT_AUDIO_PLAYER_H_ |
6 #define REMOTING_CLIENT_AUDIO_PLAYER_H_ | 6 #define REMOTING_CLIENT_AUDIO_PLAYER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <list> | 11 #include <list> |
12 #include <memory> | 12 #include <memory> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "remoting/client/audio_consumer.h" | |
17 #include "remoting/proto/audio.pb.h" | 16 #include "remoting/proto/audio.pb.h" |
| 17 #include "remoting/protocol/audio_stub.h" |
18 | 18 |
19 namespace remoting { | 19 namespace remoting { |
20 | 20 |
21 class AudioPlayer : public AudioConsumer { | 21 class AudioPlayer : public protocol::AudioStub { |
22 public: | 22 public: |
23 // The number of channels in the audio stream (only supporting stereo audio | 23 // The number of channels in the audio stream (only supporting stereo audio |
24 // for now). | 24 // for now). |
25 static const int kChannels = 2; | 25 static const int kChannels = 2; |
26 static const int kSampleSizeBytes = 2; | 26 static const int kSampleSizeBytes = 2; |
27 | 27 |
28 ~AudioPlayer() override; | 28 ~AudioPlayer() override; |
29 | 29 |
30 // AudioConsumer implementation. | 30 // protocol::AudioStub implementation. |
31 void AddAudioPacket(std::unique_ptr<AudioPacket> packet) override; | 31 void ProcessAudioPacket(std::unique_ptr<AudioPacket> packet, |
| 32 const base::Closure& done) override; |
32 | 33 |
33 protected: | 34 protected: |
34 AudioPlayer(); | 35 AudioPlayer(); |
35 | 36 |
36 // Return the recommended number of samples to include in a frame. | 37 // Return the recommended number of samples to include in a frame. |
37 virtual uint32_t GetSamplesPerFrame() = 0; | 38 virtual uint32_t GetSamplesPerFrame() = 0; |
38 | 39 |
39 // Resets the audio player and starts playback. | 40 // Resets the audio player and starts playback. |
40 // Returns true on success. | 41 // Returns true on success. |
41 virtual bool ResetAudioPlayer(AudioPacket::SamplingRate sampling_rate) = 0; | 42 virtual bool ResetAudioPlayer(AudioPacket::SamplingRate sampling_rate) = 0; |
(...skipping 28 matching lines...) Expand all Loading... |
70 | 71 |
71 // The number of bytes from |queued_packets_| that have been consumed. | 72 // The number of bytes from |queued_packets_| that have been consumed. |
72 size_t bytes_consumed_; | 73 size_t bytes_consumed_; |
73 | 74 |
74 DISALLOW_COPY_AND_ASSIGN(AudioPlayer); | 75 DISALLOW_COPY_AND_ASSIGN(AudioPlayer); |
75 }; | 76 }; |
76 | 77 |
77 } // namespace remoting | 78 } // namespace remoting |
78 | 79 |
79 #endif // REMOTING_CLIENT_AUDIO_PLAYER_H_ | 80 #endif // REMOTING_CLIENT_AUDIO_PLAYER_H_ |
OLD | NEW |