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

Side by Side Diff: content/renderer/media/media_stream_audio_track_sink.h

Issue 1834323002: MediaStream audio: Refactor 3 separate "glue" implementations into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE + Workaround to ensure MediaStreamAudioProcessor is destroyed on the main thread. Created 4 years, 7 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
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 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_SINK_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_SINK_H_
7
8 #include <vector>
9
10 #include "base/logging.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/time/time.h"
13 #include "media/base/audio_parameters.h"
14 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
15
16 namespace media {
17 class AudioBus;
18 }
19
20 namespace content {
21
22 class MediaStreamAudioSink;
23
24 // Interface for reference counted holder of audio stream audio track sink.
25 class MediaStreamAudioTrackSink
26 : public base::RefCountedThreadSafe<MediaStreamAudioTrackSink> {
27 public:
28 // Note: OnData() and OnSetFormat() have the same meaning and semantics as in
29 // content::MediaStreamAudioSink. See comments there for usage info.
30 virtual void OnData(const media::AudioBus& audio_bus,
31 base::TimeTicks estimated_capture_time) = 0;
32 virtual void OnSetFormat(const media::AudioParameters& params) = 0;
33
34 virtual void OnReadyStateChanged(
35 blink::WebMediaStreamSource::ReadyState state) = 0;
36
37 virtual void Reset() = 0;
38
39 virtual bool IsEqual(const MediaStreamAudioSink* other) const = 0;
40
41 // Wrapper which allows to use std::find_if() when adding and removing
42 // sinks to/from the list.
43 struct WrapsMediaStreamSink {
44 WrapsMediaStreamSink(MediaStreamAudioSink* sink) : sink_(sink) {}
45 bool operator()(
46 const scoped_refptr<MediaStreamAudioTrackSink>& owner) const {
47 return owner->IsEqual(sink_);
48 }
49 MediaStreamAudioSink* sink_;
50 };
51
52 protected:
53 virtual ~MediaStreamAudioTrackSink() {}
54
55 private:
56 friend class base::RefCountedThreadSafe<MediaStreamAudioTrackSink>;
57 };
58
59 } // namespace content
60
61 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_TRACK_SINK_H_
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_audio_track.cc ('k') | content/renderer/media/media_stream_audio_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698