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_PLUGIN_PEPPER_AUDIO_PLAYER_H_ | 5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_AUDIO_PLAYER_H_ |
6 #define REMOTING_CLIENT_PLUGIN_PEPPER_AUDIO_PLAYER_H_ | 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_AUDIO_PLAYER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" |
12 #include "ppapi/cpp/audio.h" | 13 #include "ppapi/cpp/audio.h" |
13 #include "ppapi/cpp/instance.h" | 14 #include "ppapi/cpp/instance.h" |
14 #include "remoting/client/audio_player.h" | 15 #include "remoting/client/audio_player.h" |
15 #include "remoting/proto/audio.pb.h" | 16 #include "remoting/proto/audio.pb.h" |
16 | 17 |
17 namespace remoting { | 18 namespace remoting { |
18 | 19 |
19 class PepperAudioPlayer : public AudioPlayer { | 20 class PepperAudioPlayer : public AudioPlayer { |
20 public: | 21 public: |
21 explicit PepperAudioPlayer(pp::Instance* instance); | 22 explicit PepperAudioPlayer(pp::Instance* instance); |
22 ~PepperAudioPlayer() override; | 23 ~PepperAudioPlayer() override; |
23 | 24 |
24 uint32_t GetSamplesPerFrame() override; | 25 uint32_t GetSamplesPerFrame() override; |
25 | 26 |
26 bool ResetAudioPlayer(AudioPacket::SamplingRate sampling_rate) override; | 27 bool ResetAudioPlayer(AudioPacket::SamplingRate sampling_rate) override; |
27 | 28 |
| 29 base::WeakPtr<PepperAudioPlayer> GetWeakPtr(); |
| 30 |
28 private: | 31 private: |
29 pp::Instance* instance_; | 32 pp::Instance* instance_; |
30 pp::Audio audio_; | 33 pp::Audio audio_; |
31 | 34 |
32 // The count of sample frames per channel in an audio buffer. | 35 // The count of sample frames per channel in an audio buffer. |
33 uint32_t samples_per_frame_; | 36 uint32_t samples_per_frame_; |
34 | 37 |
| 38 base::WeakPtrFactory<PepperAudioPlayer> weak_factory_; |
| 39 |
35 DISALLOW_COPY_AND_ASSIGN(PepperAudioPlayer); | 40 DISALLOW_COPY_AND_ASSIGN(PepperAudioPlayer); |
36 }; | 41 }; |
37 | 42 |
38 } // namespace remoting | 43 } // namespace remoting |
39 | 44 |
40 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_AUDIO_PLAYER_H_ | 45 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_AUDIO_PLAYER_H_ |
OLD | NEW |