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

Unified Diff: content/renderer/media/webrtc_audio_capturer.h

Issue 1721273002: MediaStream audio object graph untangling and clean-ups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/webrtc_audio_capturer.h
diff --git a/content/renderer/media/webrtc_audio_capturer.h b/content/renderer/media/webrtc_audio_capturer.h
index afa5f9e54b546f7a6b7b6211ccc2dd651525f189..546c3154124c2a4c3e720445481061042bcc9122 100644
--- a/content/renderer/media/webrtc_audio_capturer.h
+++ b/content/renderer/media/webrtc_audio_capturer.h
@@ -12,10 +12,12 @@
#include "base/files/file.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "content/common/media/media_stream_options.h"
+#include "content/renderer/media/media_stream_audio_level_calculator.h"
#include "content/renderer/media/tagged_list.h"
#include "media/audio/audio_input_device.h"
#include "media/base/audio_capturer_source.h"
@@ -41,8 +43,7 @@ class WebRtcLocalAudioTrack;
// thread or on the main render thread but also other client threads
// if an alternative AudioCapturerSource has been set.
class CONTENT_EXPORT WebRtcAudioCapturer
- : public base::RefCountedThreadSafe<WebRtcAudioCapturer>,
- NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback) {
+ : NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback) {
public:
// Used to construct the audio capturer. |render_frame_id| specifies the
// RenderFrame consuming audio for capture; -1 is used for tests.
@@ -50,13 +51,15 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// created for. |constraints| contains the settings for audio processing.
// TODO(xians): Implement the interface for the audio source and move the
// |constraints| to ApplyConstraints(). Called on the main render thread.
- static scoped_refptr<WebRtcAudioCapturer> CreateCapturer(
+ static scoped_ptr<WebRtcAudioCapturer> CreateCapturer(
int render_frame_id,
const StreamDeviceInfo& device_info,
const blink::WebMediaConstraints& constraints,
WebRtcAudioDeviceImpl* audio_device,
MediaStreamAudioSource* audio_source);
+ ~WebRtcAudioCapturer() override;
+
// Add a audio track to the sinks of the capturer.
// WebRtcAudioDeviceImpl calls this method on the main render thread but
// other clients may call it from other threads. The current implementation
@@ -84,16 +87,9 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// Audio parameters utilized by the source of the audio capturer.
// TODO(phoglund): Think over the implications of this accessor and if we can
// remove it.
- media::AudioParameters source_audio_parameters() const;
-
- // Gets information about the paired output device. Returns true if such a
- // device exists.
- bool GetPairedOutputParameters(int* session_id,
- int* output_sample_rate,
- int* output_frames_per_buffer) const;
+ media::AudioParameters GetInputFormat() const;
- const std::string& device_id() const { return device_info_.device.id; }
- int session_id() const { return device_info_.session_id; }
+ const StreamDeviceInfo& device_info() const { return device_info_; }
// Stops recording audio. This method will empty its track lists since
// stopping the capturer will implicitly invalidate all its tracks.
@@ -110,10 +106,6 @@ class CONTENT_EXPORT WebRtcAudioCapturer
const scoped_refptr<media::AudioCapturerSource>& source,
media::AudioParameters params);
- protected:
- friend class base::RefCountedThreadSafe<WebRtcAudioCapturer>;
- ~WebRtcAudioCapturer() override;
-
private:
class TrackOwner;
typedef TaggedList<TrackOwner> TrackList;
@@ -144,8 +136,7 @@ class CONTENT_EXPORT WebRtcAudioCapturer
void SetCapturerSourceInternal(
const scoped_refptr<media::AudioCapturerSource>& source,
media::ChannelLayout channel_layout,
- int sample_rate,
- int buffer_size);
+ int sample_rate);
// Starts recording audio.
// Triggered by AddSink() on the main render thread or a Libjingle working
@@ -176,7 +167,7 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// Audio processor doing processing like FIFO, AGC, AEC and NS. Its output
// data is in a unit of 10 ms data chunk.
- scoped_refptr<MediaStreamAudioProcessor> audio_processor_;
+ const scoped_refptr<MediaStreamAudioProcessor> audio_processor_;
bool running_;
@@ -205,6 +196,9 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// WebRtcAudioCapturer.
MediaStreamAudioSource* const audio_source_;
+ // Used to calculate the signal level that shows in the UI.
+ MediaStreamAudioLevelCalculator level_calculator_;
+
DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer);
};
« no previous file with comments | « content/renderer/media/webrtc/webrtc_media_stream_adapter_unittest.cc ('k') | content/renderer/media/webrtc_audio_capturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698