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

Unified Diff: content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h

Issue 1780653002: Revert of MediaStream audio object graph untangling and clean-ups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/webrtc_local_audio_track_adapter.h
diff --git a/content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h b/content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h
index 72b80194b08ed09a01673c98c4ed9816aa4e6d74..cfe4a98ef9d291d96e0746833ecd3edcf2dab27e 100644
--- a/content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h
+++ b/content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h
@@ -11,9 +11,8 @@
#include "base/memory/scoped_vector.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/lock.h"
+#include "base/threading/thread_checker.h"
#include "content/common/content_export.h"
-#include "content/renderer/media/media_stream_audio_level_calculator.h"
-#include "content/renderer/media/media_stream_audio_processor.h"
#include "third_party/webrtc/api/mediastreamtrack.h"
#include "third_party/webrtc/media/base/audiorenderer.h"
@@ -32,10 +31,6 @@
class WebRtcAudioSinkAdapter;
class WebRtcLocalAudioTrack;
-// Provides an implementation of the webrtc::AudioTrackInterface that can be
-// bound/unbound to/from a MediaStreamAudioTrack. In other words, this is an
-// adapter that sits between the media stream object graph and WebRtc's object
-// graph and proxies between the two.
class CONTENT_EXPORT WebRtcLocalAudioTrackAdapter
: NON_EXPORTED_BASE(
public webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>) {
@@ -47,24 +42,22 @@
WebRtcLocalAudioTrackAdapter(
const std::string& label,
webrtc::AudioSourceInterface* track_source,
- scoped_refptr<base::SingleThreadTaskRunner> signaling_task_runner);
+ const scoped_refptr<base::SingleThreadTaskRunner>& signaling_thread);
~WebRtcLocalAudioTrackAdapter() override;
void Initialize(WebRtcLocalAudioTrack* owner);
- // Set the object that provides shared access to the current audio signal
- // level. This method may only be called once, before the audio data flow
- // starts, and before any calls to GetSignalLevel() might be made.
- void SetLevel(scoped_refptr<MediaStreamAudioLevelCalculator::Level> level);
+ // Called on the audio thread by the WebRtcLocalAudioTrack to set the signal
+ // level of the audio data.
+ void SetSignalLevel(int signal_level);
// Method called by the WebRtcLocalAudioTrack to set the processor that
// applies signal processing on the data of the track.
// This class will keep a reference of the |processor|.
// Called on the main render thread.
- // This method may only be called once, before the audio data flow starts, and
- // before any calls to GetAudioProcessor() might be made.
- void SetAudioProcessor(scoped_refptr<MediaStreamAudioProcessor> processor);
+ void SetAudioProcessor(
+ const scoped_refptr<MediaStreamAudioProcessor>& processor);
// webrtc::MediaStreamTrack implementation.
std::string kind() const override;
@@ -87,19 +80,28 @@
rtc::scoped_refptr<webrtc::AudioSourceInterface> track_source_;
// Libjingle's signaling thread.
- const scoped_refptr<base::SingleThreadTaskRunner> signaling_task_runner_;
+ const scoped_refptr<base::SingleThreadTaskRunner> signaling_thread_;
// The audio processsor that applies audio processing on the data of audio
- // track. This must be set before calls to GetAudioProcessor() are made.
+ // track.
scoped_refptr<MediaStreamAudioProcessor> audio_processor_;
+
+ // A vector of WebRtc VoE channels that the capturer sends data to.
+ std::vector<int> voe_channels_;
// A vector of the peer connection sink adapters which receive the audio data
// from the audio track.
ScopedVector<WebRtcAudioSinkAdapter> sink_adapters_;
- // Thread-safe accessor to current audio signal level. This must be set
- // before calls to GetSignalLevel() are made.
- scoped_refptr<MediaStreamAudioLevelCalculator::Level> level_;
+ // The amplitude of the signal.
+ int signal_level_;
+
+ // Thread checker for libjingle's signaling thread.
+ base::ThreadChecker signaling_thread_checker_;
+ base::ThreadChecker capture_thread_;
+
+ // Protects |voe_channels_|, |audio_processor_| and |signal_level_|.
+ mutable base::Lock lock_;
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698