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 #include "remoting/client/plugin/pepper_audio_player.h" | 5 #include "remoting/client/plugin/pepper_audio_player.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 | 11 |
12 // The frame size we will request from the browser. | 12 // The frame size we will request from the browser. |
13 const int kFrameSizeMs = 40; | 13 const int kFrameSizeMs = 40; |
14 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 | 16 |
17 PepperAudioPlayer::PepperAudioPlayer(pp::Instance* instance) | 17 PepperAudioPlayer::PepperAudioPlayer(pp::Instance* instance) |
18 : instance_(instance), | 18 : instance_(instance), |
19 samples_per_frame_(0) { | 19 samples_per_frame_(0) { |
20 } | 20 } |
21 | 21 |
22 PepperAudioPlayer::~PepperAudioPlayer() { | 22 PepperAudioPlayer::~PepperAudioPlayer() { |
23 } | 23 } |
24 | 24 |
25 uint32 PepperAudioPlayer::GetSamplesPerFrame() { | 25 uint32_t PepperAudioPlayer::GetSamplesPerFrame() { |
26 return samples_per_frame_; | 26 return samples_per_frame_; |
27 } | 27 } |
28 | 28 |
29 bool PepperAudioPlayer::ResetAudioPlayer( | 29 bool PepperAudioPlayer::ResetAudioPlayer( |
30 AudioPacket::SamplingRate sampling_rate) { | 30 AudioPacket::SamplingRate sampling_rate) { |
31 PP_AudioSampleRate pp_sampling_rate = PP_AUDIOSAMPLERATE_NONE; | 31 PP_AudioSampleRate pp_sampling_rate = PP_AUDIOSAMPLERATE_NONE; |
32 switch (sampling_rate) { | 32 switch (sampling_rate) { |
33 case AudioPacket::SAMPLING_RATE_44100: | 33 case AudioPacket::SAMPLING_RATE_44100: |
34 pp_sampling_rate = PP_AUDIOSAMPLERATE_44100; | 34 pp_sampling_rate = PP_AUDIOSAMPLERATE_44100; |
35 break; | 35 break; |
(...skipping 18 matching lines...) Expand all Loading... |
54 audio_ = pp::Audio(instance_, audio_config, AudioPlayerCallback, this); | 54 audio_ = pp::Audio(instance_, audio_config, AudioPlayerCallback, this); |
55 | 55 |
56 // Immediately start the player. | 56 // Immediately start the player. |
57 bool success = audio_.StartPlayback(); | 57 bool success = audio_.StartPlayback(); |
58 if (!success) | 58 if (!success) |
59 LOG(ERROR) << "Failed to start Pepper audio player"; | 59 LOG(ERROR) << "Failed to start Pepper audio player"; |
60 return success; | 60 return success; |
61 } | 61 } |
62 | 62 |
63 } // namespace remoting | 63 } // namespace remoting |
OLD | NEW |