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

Side by Side Diff: remoting/client/plugin/pepper_audio_player.cc

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/plugin/pepper_audio_player.h ('k') | remoting/remoting_srcs.gypi » ('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 #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), samples_per_frame_(0), weak_factory_(this) {}
19 samples_per_frame_(0) {
20 }
21 19
22 PepperAudioPlayer::~PepperAudioPlayer() { 20 PepperAudioPlayer::~PepperAudioPlayer() {
23 } 21 }
24 22
25 uint32_t PepperAudioPlayer::GetSamplesPerFrame() { 23 uint32_t PepperAudioPlayer::GetSamplesPerFrame() {
26 return samples_per_frame_; 24 return samples_per_frame_;
27 } 25 }
28 26
27 base::WeakPtr<PepperAudioPlayer> PepperAudioPlayer::GetWeakPtr() {
28 return weak_factory_.GetWeakPtr();
29 }
30
29 bool PepperAudioPlayer::ResetAudioPlayer( 31 bool PepperAudioPlayer::ResetAudioPlayer(
30 AudioPacket::SamplingRate sampling_rate) { 32 AudioPacket::SamplingRate sampling_rate) {
31 PP_AudioSampleRate pp_sampling_rate = PP_AUDIOSAMPLERATE_NONE; 33 PP_AudioSampleRate pp_sampling_rate = PP_AUDIOSAMPLERATE_NONE;
32 switch (sampling_rate) { 34 switch (sampling_rate) {
33 case AudioPacket::SAMPLING_RATE_44100: 35 case AudioPacket::SAMPLING_RATE_44100:
34 pp_sampling_rate = PP_AUDIOSAMPLERATE_44100; 36 pp_sampling_rate = PP_AUDIOSAMPLERATE_44100;
35 break; 37 break;
36 case AudioPacket::SAMPLING_RATE_48000: 38 case AudioPacket::SAMPLING_RATE_48000:
37 pp_sampling_rate = PP_AUDIOSAMPLERATE_48000; 39 pp_sampling_rate = PP_AUDIOSAMPLERATE_48000;
38 break; 40 break;
(...skipping 15 matching lines...) Expand all
54 audio_ = pp::Audio(instance_, audio_config, AudioPlayerCallback, this); 56 audio_ = pp::Audio(instance_, audio_config, AudioPlayerCallback, this);
55 57
56 // Immediately start the player. 58 // Immediately start the player.
57 bool success = audio_.StartPlayback(); 59 bool success = audio_.StartPlayback();
58 if (!success) 60 if (!success)
59 LOG(ERROR) << "Failed to start Pepper audio player"; 61 LOG(ERROR) << "Failed to start Pepper audio player";
60 return success; 62 return success;
61 } 63 }
62 64
63 } // namespace remoting 65 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_audio_player.h ('k') | remoting/remoting_srcs.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698