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

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

Issue 2626533002: Revert of Fix getUserMedia so that failure is reported for invalid audio sources. (Closed)
Patch Set: Created 3 years, 11 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_
6 #define CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_ 6 #define CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_
7 7
8 #include "content/renderer/media/media_stream_audio_source.h" 8 #include "content/renderer/media/media_stream_audio_source.h"
9 #include "media/base/audio_capturer_source.h" 9 #include "media/base/audio_capturer_source.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 // Represents a local source of audio data generated by an AudioInputDevice. 13 // Represents a local source of audio data generated by an AudioInputDevice.
14 // Uses content::AudioDeviceFactory to auto-create the AudioInputDevice, using 14 // Uses content::AudioDeviceFactory to auto-create the AudioInputDevice, using
15 // the parameters and session ID found in StreamDeviceInfo, just before the 15 // the parameters and session ID found in StreamDeviceInfo, just before the
16 // first track is connected. Audio data is transported directly to the tracks 16 // first track is connected. Audio data is transported directly to the tracks
17 // (i.e., there is no audio processing). 17 // (i.e., there is no audio processing).
18 class CONTENT_EXPORT LocalMediaStreamAudioSource 18 class CONTENT_EXPORT LocalMediaStreamAudioSource
19 : NON_EXPORTED_BASE(public MediaStreamAudioSource), 19 : NON_EXPORTED_BASE(public MediaStreamAudioSource),
20 NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback) { 20 NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback) {
21 public: 21 public:
22 // |consumer_render_frame_id| references the RenderFrame that will consume the 22 // |consumer_render_frame_id| references the RenderFrame that will consume the
23 // audio data. Audio parameters and (optionally) a pre-existing audio session 23 // audio data. Audio parameters and (optionally) a pre-existing audio session
24 // ID are read from |device_info|. 24 // ID are read from |device_info|.
25 LocalMediaStreamAudioSource(int consumer_render_frame_id, 25 LocalMediaStreamAudioSource(int consumer_render_frame_id,
26 const StreamDeviceInfo& device_info, 26 const StreamDeviceInfo& device_info);
27 const ConstraintsCallback& started_callback);
28 27
29 ~LocalMediaStreamAudioSource() final; 28 ~LocalMediaStreamAudioSource() final;
30 29
31 private: 30 private:
32 // MediaStreamAudioSource implementation. 31 // MediaStreamAudioSource implementation.
33 bool EnsureSourceIsStarted() final; 32 bool EnsureSourceIsStarted() final;
34 void EnsureSourceIsStopped() final; 33 void EnsureSourceIsStopped() final;
35 34
36 // media::AudioCapturerSource::CaptureCallback implementation. 35 // media::AudioCapturerSource::CaptureCallback implementation.
37 void OnCaptureStarted() final;
38 void Capture(const media::AudioBus* audio_bus, 36 void Capture(const media::AudioBus* audio_bus,
39 int audio_delay_milliseconds, 37 int audio_delay_milliseconds,
40 double volume, 38 double volume,
41 bool key_pressed) final; 39 bool key_pressed) final;
42 void OnCaptureError(const std::string& message) final; 40 void OnCaptureError(const std::string& message) final;
43 41
44 // The RenderFrame that will consume the audio data. Used when creating 42 // The RenderFrame that will consume the audio data. Used when creating
45 // AudioInputDevices via the AudioDeviceFactory. 43 // AudioInputDevices via the AudioDeviceFactory.
46 const int consumer_render_frame_id_; 44 const int consumer_render_frame_id_;
47 45
48 // The device created by the AudioDeviceFactory in EnsureSourceIsStarted(). 46 // The device created by the AudioDeviceFactory in EnsureSourceIsStarted().
49 scoped_refptr<media::AudioCapturerSource> source_; 47 scoped_refptr<media::AudioCapturerSource> source_;
50 48
51 // Callback that's called when the audio source has been initialized.
52 ConstraintsCallback started_callback_;
53
54 // In debug builds, check that all methods that could cause object graph 49 // In debug builds, check that all methods that could cause object graph
55 // or data flow changes are being called on the main thread. 50 // or data flow changes are being called on the main thread.
56 base::ThreadChecker thread_checker_; 51 base::ThreadChecker thread_checker_;
57 52
58 DISALLOW_COPY_AND_ASSIGN(LocalMediaStreamAudioSource); 53 DISALLOW_COPY_AND_ASSIGN(LocalMediaStreamAudioSource);
59 }; 54 };
60 55
61 } // namespace content 56 } // namespace content
62 57
63 #endif // CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_ 58 #endif // CONTENT_RENDERER_MEDIA_LOCAL_MEDIA_STREAM_AUDIO_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698