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

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

Issue 90743004: Add generic interfaces for the sinks of the media stream audio track (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed the nits. Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/renderer/media/media_stream_audio_sink_owner.h"
6
7 #include "content/public/renderer/media_stream_audio_sink.h"
8 #include "media/audio/audio_parameters.h"
9
10 namespace content {
11
12 MediaStreamAudioSinkOwner::MediaStreamAudioSinkOwner(MediaStreamAudioSink* sink)
13 : delegate_(sink) {
14 }
15
16 int MediaStreamAudioSinkOwner::OnData(const int16* audio_data,
17 int sample_rate,
18 int number_of_channels,
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_);
26 // TODO(xians): Investigate on the possibility of not calling out with the
27 // lock.
28 if (delegate_) {
29 delegate_->OnData(audio_data,
30 sample_rate,
31 number_of_channels,
32 number_of_frames);
33 }
34
35 return 0;
36 }
37
38 void MediaStreamAudioSinkOwner::OnSetFormat(
39 const media::AudioParameters& params) {
40 base::AutoLock lock(lock_);
41 if (delegate_)
42 delegate_->OnSetFormat(params);
43 }
44
45 void MediaStreamAudioSinkOwner::Reset() {
46 base::AutoLock lock(lock_);
47 delegate_ = NULL;
48 }
49
50 bool MediaStreamAudioSinkOwner::IsEqual(
51 const MediaStreamAudioSink* other) const {
52 DCHECK(other);
53 base::AutoLock lock(lock_);
54 return (other == delegate_);
55 }
56
57 bool MediaStreamAudioSinkOwner::IsEqual(
58 const PeerConnectionAudioSink* other) const {
59 DCHECK(other);
60 return false;
61 }
62
63 } // 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