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

Side by Side Diff: content/renderer/media/media_stream_audio_sink_owner.cc

Issue 671793004: Clean up the media stream audio track code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/media/media_stream_audio_sink_owner.h" 5 #include "content/renderer/media/media_stream_audio_sink_owner.h"
6 6
7 #include "content/public/renderer/media_stream_audio_sink.h" 7 #include "content/public/renderer/media_stream_audio_sink.h"
8 #include "media/audio/audio_parameters.h" 8 #include "media/audio/audio_parameters.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 MediaStreamAudioSinkOwner::MediaStreamAudioSinkOwner(MediaStreamAudioSink* sink) 12 MediaStreamAudioSinkOwner::MediaStreamAudioSinkOwner(MediaStreamAudioSink* sink)
13 : delegate_(sink) { 13 : delegate_(sink) {
14 } 14 }
15 15
16 int MediaStreamAudioSinkOwner::OnData(const int16* audio_data, 16 void MediaStreamAudioSinkOwner::OnData(const int16* audio_data,
17 int sample_rate, 17 int sample_rate,
18 int number_of_channels, 18 int number_of_channels,
19 int number_of_frames, 19 int number_of_frames) {
20 const std::vector<int>& channels,
21 int audio_delay_milliseconds,
22 int current_volume,
23 bool need_audio_processing,
24 bool key_pressed) {
25 base::AutoLock lock(lock_); 20 base::AutoLock lock(lock_);
26 // TODO(xians): Investigate on the possibility of not calling out with the
27 // lock.
28 if (delegate_) { 21 if (delegate_) {
29 delegate_->OnData(audio_data, 22 delegate_->OnData(audio_data,
30 sample_rate, 23 sample_rate,
31 number_of_channels, 24 number_of_channels,
32 number_of_frames); 25 number_of_frames);
33 } 26 }
34
35 return 0;
36 } 27 }
37 28
38 void MediaStreamAudioSinkOwner::OnSetFormat( 29 void MediaStreamAudioSinkOwner::OnSetFormat(
39 const media::AudioParameters& params) { 30 const media::AudioParameters& params) {
40 base::AutoLock lock(lock_); 31 base::AutoLock lock(lock_);
41 if (delegate_) 32 if (delegate_)
42 delegate_->OnSetFormat(params); 33 delegate_->OnSetFormat(params);
43 } 34 }
44 35
45 void MediaStreamAudioSinkOwner::OnReadyStateChanged( 36 void MediaStreamAudioSinkOwner::OnReadyStateChanged(
46 blink::WebMediaStreamSource::ReadyState state) { 37 blink::WebMediaStreamSource::ReadyState state) {
47 base::AutoLock lock(lock_); 38 base::AutoLock lock(lock_);
48 if (delegate_) 39 if (delegate_)
49 delegate_->OnReadyStateChanged(state); 40 delegate_->OnReadyStateChanged(state);
50 } 41 }
51 42
52 void MediaStreamAudioSinkOwner::Reset() { 43 void MediaStreamAudioSinkOwner::Reset() {
53 base::AutoLock lock(lock_); 44 base::AutoLock lock(lock_);
54 delegate_ = NULL; 45 delegate_ = NULL;
55 } 46 }
56 47
57 bool MediaStreamAudioSinkOwner::IsEqual( 48 bool MediaStreamAudioSinkOwner::IsEqual(
58 const MediaStreamAudioSink* other) const { 49 const MediaStreamAudioSink* other) const {
59 DCHECK(other); 50 DCHECK(other);
60 base::AutoLock lock(lock_); 51 base::AutoLock lock(lock_);
61 return (other == delegate_); 52 return (other == delegate_);
62 } 53 }
63 54
64 bool MediaStreamAudioSinkOwner::IsEqual(
65 const PeerConnectionAudioSink* other) const {
66 DCHECK(other);
67 return false;
68 }
69
70 } // namespace content 55 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_audio_sink_owner.h ('k') | content/renderer/media/media_stream_audio_track_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698