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

Side by Side Diff: content/renderer/media/peer_connection_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: added a DCHECK(other) and rebased 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/peer_connection_audio_sink_owner.h"
6
7 #include "content/renderer/media/webrtc_audio_device_impl.h"
8
9 namespace content {
10
11 PeerConnectionAudioSinkOwner::PeerConnectionAudioSinkOwner(
12 PeerConnectionAudioSink* sink)
13 : delegate_(sink) {
14 }
15
16 int PeerConnectionAudioSinkOwner::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 if (delegate_) {
27 return delegate_->OnData(audio_data,
28 sample_rate,
29 number_of_channels,
30 number_of_frames,
31 channels,
32 audio_delay_milliseconds,
33 current_volume,
34 need_audio_processing,
35 key_pressed);
36 }
37
38 return 0;
39 }
40
41 void PeerConnectionAudioSinkOwner::OnSetFormat(
tommi (sloooow) - chröme 2013/11/29 13:00:20 can we add thread checks for functions that are ex
no longer working on chromium 2013/11/29 15:02:04 as discussed offline, we can skip this for now sin
42 const media::AudioParameters& params) {
43 base::AutoLock lock(lock_);
44 if (delegate_)
45 delegate_->OnSetFormat(params);
46 }
47
48 void PeerConnectionAudioSinkOwner::Reset() {
49 base::AutoLock lock(lock_);
50 delegate_ = NULL;
51 }
52
53 bool PeerConnectionAudioSinkOwner::IsEqual(
54 const PeerConnectionAudioSink* other) const {
55 DCHECK(other);
tommi (sloooow) - chröme 2013/11/29 13:00:20 nit: No need for this dcheck now.
no longer working on chromium 2013/11/29 15:02:04 It is unclear to me, shouldn't the client take car
56 base::AutoLock lock(lock_);
57 return (other == delegate_);
58 }
59
60 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698