OLD | NEW |
---|---|
(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 #ifndef CONTENT_RENDERER_MEDIA_PEER_CONNECTION_AUDIO_SINK_OWNER_H_ | |
6 #define CONTENT_RENDERER_MEDIA_PEER_CONNECTION_AUDIO_SINK_OWNER_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/synchronization/lock.h" | |
11 #include "content/renderer/media/media_stream_audio_track_sink.h" | |
12 | |
13 namespace content { | |
14 | |
15 class PeerConnectionAudioSink; | |
16 | |
17 // Reference counted holder of PeerConnectionAudioSink. | |
18 class PeerConnectionAudioSinkOwner | |
19 : public MediaStreamAudioTrackSink { | |
20 public: | |
21 explicit PeerConnectionAudioSinkOwner(PeerConnectionAudioSink* sink); | |
22 | |
23 // MediaStreamAudioTrackSink implementation. | |
24 virtual int OnData(const int16* audio_data, | |
25 int sample_rate, | |
26 int number_of_channels, | |
27 int number_of_frames, | |
28 const std::vector<int>& channels, | |
29 int audio_delay_milliseconds, | |
30 int current_volume, | |
31 bool need_audio_processing, | |
32 bool key_pressed) OVERRIDE; | |
33 virtual void OnSetFormat(const media::AudioParameters& params) OVERRIDE; | |
34 virtual void Reset() OVERRIDE; | |
35 virtual bool IsEqual(const PeerConnectionAudioSink* other) const OVERRIDE; | |
36 virtual bool IsEqual(const MediaStreamAudioSink* other) const OVERRIDE{ | |
tommi (sloooow) - chröme
2013/11/29 13:00:20
do you need to override this?
no longer working on chromium
2013/11/29 15:02:04
Yes. For example, when a new MediaStreamAudioSink
| |
37 return false; | |
38 } | |
39 | |
40 protected: | |
41 virtual ~PeerConnectionAudioSinkOwner() {} | |
42 | |
43 private: | |
44 mutable base::Lock lock_; | |
45 | |
46 // Weak reference to the delegate, the client need to call Reset() to set the | |
tommi (sloooow) - chröme
2013/11/29 13:00:20
nit: Raw pointer
s/the client need/the client need
no longer working on chromium
2013/11/29 15:02:04
Done.
| |
47 // pointer to NULL before the delegate goes away. | |
48 PeerConnectionAudioSink* delegate_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(PeerConnectionAudioSinkOwner); | |
51 }; | |
52 | |
53 } // namespace content | |
54 | |
55 #endif // CONTENT_RENDERER_MEDIA_PEER_CONNECTION_AUDIO_SINK_OWNER_H_ | |
OLD | NEW |