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

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

Issue 1542203002: Switch to standard integer types in remoting/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@int-remoting-host
Patch Set: Created 5 years 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_decode_scheduler.cc ('k') | remoting/client/audio_player.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 (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>
9 #include <stdint.h>
10
8 #include <list> 11 #include <list>
9 12
13 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
11 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
12 #include "remoting/proto/audio.pb.h" 16 #include "remoting/proto/audio.pb.h"
13 17
14 namespace remoting { 18 namespace remoting {
15 19
16 class AudioPlayer { 20 class AudioPlayer {
17 public: 21 public:
18 virtual ~AudioPlayer(); 22 virtual ~AudioPlayer();
19 23
20 void ProcessAudioPacket(scoped_ptr<AudioPacket> packet); 24 void ProcessAudioPacket(scoped_ptr<AudioPacket> packet);
21 25
22 protected: 26 protected:
23 AudioPlayer(); 27 AudioPlayer();
24 28
25 // Return the recommended number of samples to include in a frame. 29 // Return the recommended number of samples to include in a frame.
26 virtual uint32 GetSamplesPerFrame() = 0; 30 virtual uint32_t GetSamplesPerFrame() = 0;
27 31
28 // Resets the audio player and starts playback. 32 // Resets the audio player and starts playback.
29 // Returns true on success. 33 // Returns true on success.
30 virtual bool ResetAudioPlayer(AudioPacket::SamplingRate sampling_rate) = 0; 34 virtual bool ResetAudioPlayer(AudioPacket::SamplingRate sampling_rate) = 0;
31 35
32 // Function called by the browser when it needs more audio samples. 36 // Function called by the browser when it needs more audio samples.
33 static void AudioPlayerCallback(void* samples, 37 static void AudioPlayerCallback(void* samples,
34 uint32 buffer_size, 38 uint32_t buffer_size,
35 void* data); 39 void* data);
36 40
37 private: 41 private:
38 friend class AudioPlayerTest; 42 friend class AudioPlayerTest;
39 43
40 typedef std::list<AudioPacket*> AudioPacketQueue; 44 typedef std::list<AudioPacket*> AudioPacketQueue;
41 45
42 void ResetQueue(); 46 void ResetQueue();
43 void FillWithSamples(void* samples, uint32 buffer_size); 47 void FillWithSamples(void* samples, uint32_t buffer_size);
44 48
45 AudioPacket::SamplingRate sampling_rate_; 49 AudioPacket::SamplingRate sampling_rate_;
46 50
47 bool start_failed_; 51 bool start_failed_;
48 52
49 // Protects |queued_packets_|, |queued_samples_ and |bytes_consumed_|. This is 53 // Protects |queued_packets_|, |queued_samples_ and |bytes_consumed_|. This is
50 // necessary to prevent races, because Pepper will call the callback on a 54 // necessary to prevent races, because Pepper will call the callback on a
51 // separate thread. 55 // separate thread.
52 base::Lock lock_; 56 base::Lock lock_;
53 57
54 AudioPacketQueue queued_packets_; 58 AudioPacketQueue queued_packets_;
55 int queued_bytes_; 59 int queued_bytes_;
56 60
57 // The number of bytes from |queued_packets_| that have been consumed. 61 // The number of bytes from |queued_packets_| that have been consumed.
58 size_t bytes_consumed_; 62 size_t bytes_consumed_;
59 63
60 DISALLOW_COPY_AND_ASSIGN(AudioPlayer); 64 DISALLOW_COPY_AND_ASSIGN(AudioPlayer);
61 }; 65 };
62 66
63 } // namespace remoting 67 } // namespace remoting
64 68
65 #endif // REMOTING_CLIENT_AUDIO_PLAYER_H_ 69 #endif // REMOTING_CLIENT_AUDIO_PLAYER_H_
OLDNEW
« no previous file with comments | « remoting/client/audio_decode_scheduler.cc ('k') | remoting/client/audio_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698