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

Side by Side Diff: remoting/client/audio_player_android.h

Issue 2052723002: Adding an interface to allow extention of the audio player for CRD and iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments in CL. Created 4 years, 6 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
« no previous file with comments | « remoting/client/audio_player.cc ('k') | remoting/client/audio_player_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 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_PLAYER_ANDROID_H_ 5 #ifndef REMOTING_CLIENT_AUDIO_PLAYER_ANDROID_H_
6 #define REMOTING_CLIENT_AUDIO_PLAYER_ANDROID_H_ 6 #define REMOTING_CLIENT_AUDIO_PLAYER_ANDROID_H_
7 7
8 #include <SLES/OpenSLES.h> 8 #include <SLES/OpenSLES.h>
9 #include <SLES/OpenSLES_Android.h> 9 #include <SLES/OpenSLES_Android.h>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
12 #include "remoting/client/audio_player.h" 13 #include "remoting/client/audio_player.h"
13 14
14 namespace remoting { 15 namespace remoting {
15 16
16 class AudioPlayerAndroid : public AudioPlayer { 17 class AudioPlayerAndroid : public AudioPlayer {
17 public: 18 public:
18 AudioPlayerAndroid(); 19 AudioPlayerAndroid();
19 ~AudioPlayerAndroid() override; 20 ~AudioPlayerAndroid() override;
20 21
22 base::WeakPtr<AudioPlayerAndroid> GetWeakPtr();
23
21 // AudioPlayer overrides. 24 // AudioPlayer overrides.
22 uint32_t GetSamplesPerFrame() override; 25 uint32_t GetSamplesPerFrame() override;
23 bool ResetAudioPlayer(AudioPacket::SamplingRate sampling_rate) override; 26 bool ResetAudioPlayer(AudioPacket::SamplingRate sampling_rate) override;
24 27
25 private: 28 private:
26 // Called when new data is needed for the buffer queue. 29 // Called when new data is needed for the buffer queue.
27 static void BufferQueueCallback(SLAndroidSimpleBufferQueueItf caller, 30 static void BufferQueueCallback(SLAndroidSimpleBufferQueueItf caller,
28 void* args); 31 void* args);
29 static SLDataFormat_PCM CreatePcmFormat(int sampling_rate); 32 static SLDataFormat_PCM CreatePcmFormat(int sampling_rate);
30 33
31 // Destroys the player and releases the buffer. Do nothing if the player is 34 // Destroys the player and releases the buffer. Do nothing if the player is
32 // nullptr. 35 // nullptr.
33 void DestroyPlayer(); 36 void DestroyPlayer();
34 37
35 SLObjectItf engine_object_ = nullptr; 38 SLObjectItf engine_object_ = nullptr;
36 SLEngineItf engine_ = nullptr; 39 SLEngineItf engine_ = nullptr;
37 SLObjectItf output_mix_object_ = nullptr; 40 SLObjectItf output_mix_object_ = nullptr;
38 SLObjectItf player_object_ = nullptr; 41 SLObjectItf player_object_ = nullptr;
39 SLPlayItf player_ = nullptr; 42 SLPlayItf player_ = nullptr;
40 SLAndroidSimpleBufferQueueItf buffer_queue_ = nullptr; 43 SLAndroidSimpleBufferQueueItf buffer_queue_ = nullptr;
41 std::unique_ptr<uint8_t[]> frame_buffer_; 44 std::unique_ptr<uint8_t[]> frame_buffer_;
42 size_t buffer_size_ = 0; 45 size_t buffer_size_ = 0;
43 uint32_t sample_per_frame_ = 0; 46 uint32_t sample_per_frame_ = 0;
44 47
48 base::WeakPtrFactory<AudioPlayerAndroid> weak_factory_;
49
45 DISALLOW_COPY_AND_ASSIGN(AudioPlayerAndroid); 50 DISALLOW_COPY_AND_ASSIGN(AudioPlayerAndroid);
46 }; 51 };
47 52
48 } // namespace remoting 53 } // namespace remoting
49 54
50 #endif // REMOTING_CLIENT_AUDIO_PLAYER_ANDROID_H_ 55 #endif // REMOTING_CLIENT_AUDIO_PLAYER_ANDROID_H_
OLDNEW
« no previous file with comments | « remoting/client/audio_player.cc ('k') | remoting/client/audio_player_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698