| 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" | 16 #include "remoting/client/audio_consumer.h" |
| 17 #include "remoting/proto/audio.pb.h" | 17 #include "remoting/proto/audio.pb.h" |
| 18 | 18 |
| 19 namespace remoting { | 19 namespace remoting { |
| 20 | 20 |
| 21 class AudioPlayer : public AudioConsumer { | 21 class AudioPlayer : public AudioConsumer { |
| 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 void ProcessAudioPacket(std::unique_ptr<AudioPacket> packet); | |
| 31 | |
| 32 // AudioConsumer implementation. | 30 // AudioConsumer implementation. |
| 33 void AddAudioPacket(std::unique_ptr<AudioPacket> packet) override; | 31 void AddAudioPacket(std::unique_ptr<AudioPacket> packet) override; |
| 34 | 32 |
| 35 protected: | 33 protected: |
| 36 AudioPlayer(); | 34 AudioPlayer(); |
| 37 | 35 |
| 38 // Return the recommended number of samples to include in a frame. | 36 // Return the recommended number of samples to include in a frame. |
| 39 virtual uint32_t GetSamplesPerFrame() = 0; | 37 virtual uint32_t GetSamplesPerFrame() = 0; |
| 40 | 38 |
| 41 // Resets the audio player and starts playback. | 39 // Resets the audio player and starts playback. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 72 | 70 |
| 73 // The number of bytes from |queued_packets_| that have been consumed. | 71 // The number of bytes from |queued_packets_| that have been consumed. |
| 74 size_t bytes_consumed_; | 72 size_t bytes_consumed_; |
| 75 | 73 |
| 76 DISALLOW_COPY_AND_ASSIGN(AudioPlayer); | 74 DISALLOW_COPY_AND_ASSIGN(AudioPlayer); |
| 77 }; | 75 }; |
| 78 | 76 |
| 79 } // namespace remoting | 77 } // namespace remoting |
| 80 | 78 |
| 81 #endif // REMOTING_CLIENT_AUDIO_PLAYER_H_ | 79 #endif // REMOTING_CLIENT_AUDIO_PLAYER_H_ |
| OLD | NEW |