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

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

Issue 187913002: Support the Aec dump for the APM in chrome (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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_WEBRTC_AUDIO_DEVICE_IMPL_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 #include "content/renderer/media/webrtc_audio_capturer.h" 18 #include "content/renderer/media/webrtc_audio_capturer.h"
19 #include "content/renderer/media/webrtc_audio_device_not_impl.h" 19 #include "content/renderer/media/webrtc_audio_device_not_impl.h"
20 #include "content/renderer/media/webrtc_audio_renderer.h" 20 #include "content/renderer/media/webrtc_audio_renderer.h"
21 #include "ipc/ipc_platform_file.h"
21 #include "media/base/audio_capturer_source.h" 22 #include "media/base/audio_capturer_source.h"
22 #include "media/base/audio_renderer_sink.h" 23 #include "media/base/audio_renderer_sink.h"
23 24
24 // A WebRtcAudioDeviceImpl instance implements the abstract interface 25 // A WebRtcAudioDeviceImpl instance implements the abstract interface
25 // webrtc::AudioDeviceModule which makes it possible for a user (e.g. webrtc:: 26 // webrtc::AudioDeviceModule which makes it possible for a user (e.g. webrtc::
26 // VoiceEngine) to register this class as an external AudioDeviceModule (ADM). 27 // VoiceEngine) to register this class as an external AudioDeviceModule (ADM).
27 // Then WebRtcAudioDeviceImpl::SetSessionId() needs to be called to set the 28 // Then WebRtcAudioDeviceImpl::SetSessionId() needs to be called to set the
28 // session id that tells which device to use. The user can then call 29 // session id that tells which device to use. The user can then call
29 // WebRtcAudioDeviceImpl::StartPlayout() and 30 // WebRtcAudioDeviceImpl::StartPlayout() and
30 // WebRtcAudioDeviceImpl::StartRecording() from the render process to initiate 31 // WebRtcAudioDeviceImpl::StartRecording() from the render process to initiate
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // Returns true if the capture device has a paired output device, otherwise 339 // Returns true if the capture device has a paired output device, otherwise
339 // false. Note that if there are more than one open capture device the 340 // false. Note that if there are more than one open capture device the
340 // function will not be able to pick an appropriate device and return false. 341 // function will not be able to pick an appropriate device and return false.
341 bool GetAuthorizedDeviceInfoForAudioRenderer( 342 bool GetAuthorizedDeviceInfoForAudioRenderer(
342 int* session_id, int* output_sample_rate, int* output_buffer_size); 343 int* session_id, int* output_sample_rate, int* output_buffer_size);
343 344
344 const scoped_refptr<WebRtcAudioRenderer>& renderer() const { 345 const scoped_refptr<WebRtcAudioRenderer>& renderer() const {
345 return renderer_; 346 return renderer_;
346 } 347 }
347 348
349 // Enables the Aec dump. When this method is called, Aec dump will be
350 // started on the default capturer.
Henrik Grunell 2014/03/06 10:12:20 Comment that it takes ownership of |file_handle|.
no longer working on chromium 2014/03/06 18:57:21 Done.
351 void EnableAecDump(IPC::PlatformFileForTransit file_handle);
352
353 // Disables the Aec dump. When this method is called, the ongoing Aec dump
354 // will be stopped, and no Aec dump will be started.
355 void DisableAecDump();
356
348 private: 357 private:
349 typedef std::list<scoped_refptr<WebRtcAudioCapturer> > CapturerList; 358 typedef std::list<scoped_refptr<WebRtcAudioCapturer> > CapturerList;
350 typedef std::list<WebRtcPlayoutDataSource::Sink*> PlayoutDataSinkList; 359 typedef std::list<WebRtcPlayoutDataSource::Sink*> PlayoutDataSinkList;
351 class RenderBuffer; 360 class RenderBuffer;
352 361
353 // Make destructor private to ensure that we can only be deleted by Release(). 362 // Make destructor private to ensure that we can only be deleted by Release().
354 virtual ~WebRtcAudioDeviceImpl(); 363 virtual ~WebRtcAudioDeviceImpl();
355 364
356 // PeerConnectionAudioSink implementation. 365 // PeerConnectionAudioSink implementation.
357 366
(...skipping 18 matching lines...) Expand all
376 int sample_rate, 385 int sample_rate,
377 int audio_delay_milliseconds) OVERRIDE; 386 int audio_delay_milliseconds) OVERRIDE;
378 387
379 // Called on the main render thread. 388 // Called on the main render thread.
380 virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) OVERRIDE; 389 virtual void RemoveAudioRenderer(WebRtcAudioRenderer* renderer) OVERRIDE;
381 390
382 // WebRtcPlayoutDataSource implementation. 391 // WebRtcPlayoutDataSource implementation.
383 virtual void AddPlayoutSink(WebRtcPlayoutDataSource::Sink* sink) OVERRIDE; 392 virtual void AddPlayoutSink(WebRtcPlayoutDataSource::Sink* sink) OVERRIDE;
384 virtual void RemovePlayoutSink(WebRtcPlayoutDataSource::Sink* sink) OVERRIDE; 393 virtual void RemovePlayoutSink(WebRtcPlayoutDataSource::Sink* sink) OVERRIDE;
385 394
395 // This method will stop the Aec dump on all the non-default capturer and
396 // start the Aec dump on the default capturer.
397 void StartAecDump();
Henrik Grunell 2014/03/06 10:12:20 Stick with either Enable/Disable or Start/Stop nam
no longer working on chromium 2014/03/06 18:57:21 I suggest not. It is better to put all the code to
Henrik Grunell 2014/03/06 19:55:12 I just meant the naming of the functions. Either S
398
399 // This method will stop the Aec dump on the default capturer.
400 void StopAecDump();
401
386 // Used to DCHECK that we are called on the correct thread. 402 // Used to DCHECK that we are called on the correct thread.
387 base::ThreadChecker thread_checker_; 403 base::ThreadChecker thread_checker_;
388 404
389 int ref_count_; 405 int ref_count_;
390 406
391 // List of captures which provides access to the native audio input layer 407 // List of captures which provides access to the native audio input layer
392 // in the browser process. 408 // in the browser process.
393 CapturerList capturers_; 409 CapturerList capturers_;
394 410
395 // Provides access to the audio renderer in the browser process. 411 // Provides access to the audio renderer in the browser process.
(...skipping 28 matching lines...) Expand all
424 bool recording_; 440 bool recording_;
425 441
426 // Stores latest microphone volume received in a CaptureData() callback. 442 // Stores latest microphone volume received in a CaptureData() callback.
427 // Range is [0, 255]. 443 // Range is [0, 255].
428 uint32_t microphone_volume_; 444 uint32_t microphone_volume_;
429 445
430 // Buffer used for temporary storage during render callback. 446 // Buffer used for temporary storage during render callback.
431 // It is only accessed by the audio render thread. 447 // It is only accessed by the audio render thread.
432 std::vector<int16> render_buffer_; 448 std::vector<int16> render_buffer_;
433 449
450 // Used for start the Aec dump on the default capturer.
451 base::PlatformFile aec_dump_file_;
452
434 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); 453 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl);
435 }; 454 };
436 455
437 } // namespace content 456 } // namespace content
438 457
439 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ 458 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698