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

Unified Diff: content/test/webrtc_audio_device_test.cc

Issue 11880009: Introduce AudioHardwareConfig for renderer side audio device info. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style nits. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/webrtc_audio_device_test.h ('k') | media/audio/audio_output_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/webrtc_audio_device_test.cc
diff --git a/content/test/webrtc_audio_device_test.cc b/content/test/webrtc_audio_device_test.cc
index b31d4bb50f94aaa12b6b922c91ccaf0ffb32c434..fa6417f4811280780062316bdd92be67f4b10ad2 100644
--- a/content/test/webrtc_audio_device_test.cc
+++ b/content/test/webrtc_audio_device_test.cc
@@ -21,13 +21,13 @@
#include "content/public/common/content_paths.h"
#include "content/public/test/mock_resource_context.h"
#include "content/public/test/test_browser_thread.h"
-#include "content/renderer/media/audio_hardware.h"
#include "content/renderer/media/audio_input_message_filter.h"
#include "content/renderer/media/audio_message_filter.h"
#include "content/renderer/media/webrtc_audio_device_impl.h"
#include "content/renderer/render_process.h"
#include "content/renderer/render_thread_impl.h"
#include "content/renderer/renderer_webkitplatformsupport_impl.h"
+#include "media/base/audio_hardware_config.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -115,7 +115,7 @@ ACTION_P(QuitMessageLoop, loop_or_proxy) {
}
WebRTCAudioDeviceTest::WebRTCAudioDeviceTest()
- : render_thread_(NULL), audio_util_callback_(NULL),
+ : render_thread_(NULL), audio_hardware_config_(NULL),
has_input_devices_(false), has_output_devices_(false) {
}
@@ -147,7 +147,7 @@ void WebRTCAudioDeviceTest::SetUp() {
}
void WebRTCAudioDeviceTest::TearDown() {
- SetAudioUtilCallback(NULL);
+ SetAudioHardwareConfig(NULL);
// Run any pending cleanup tasks that may have been posted to the main thread.
ChildProcess::current()->main_thread()->message_loop()->RunUntilIdle();
@@ -183,11 +183,9 @@ bool WebRTCAudioDeviceTest::Send(IPC::Message* message) {
return channel_->Send(message);
}
-void WebRTCAudioDeviceTest::SetAudioUtilCallback(AudioUtilInterface* callback) {
- // Invalidate any potentially cached values since the new callback should
- // be used for those queries.
- ResetAudioCache();
- audio_util_callback_ = callback;
+void WebRTCAudioDeviceTest::SetAudioHardwareConfig(
+ media::AudioHardwareConfig* hardware_config) {
+ audio_hardware_config_ = hardware_config;
}
void WebRTCAudioDeviceTest::InitializeIOThread(const char* thread_name) {
@@ -261,25 +259,17 @@ void WebRTCAudioDeviceTest::DestroyChannel() {
audio_input_renderer_host_ = NULL;
}
-void WebRTCAudioDeviceTest::OnGetHardwareSampleRate(int* sample_rate) {
- EXPECT_TRUE(audio_util_callback_);
- *sample_rate = audio_util_callback_ ?
- audio_util_callback_->GetAudioHardwareSampleRate() : 0;
-}
+void WebRTCAudioDeviceTest::OnGetAudioHardwareConfig(
+ int* output_buffer_size, int* output_sample_rate, int* input_sample_rate,
+ media::ChannelLayout* input_channel_layout) {
+ ASSERT_TRUE(audio_hardware_config_);
-void WebRTCAudioDeviceTest::OnGetHardwareInputSampleRate(int* sample_rate) {
- EXPECT_TRUE(audio_util_callback_);
- *sample_rate = audio_util_callback_ ?
- audio_util_callback_->GetAudioInputHardwareSampleRate(
- media::AudioManagerBase::kDefaultDeviceId) : 0;
-}
+ *output_buffer_size = audio_hardware_config_->GetOutputBufferSize();
+ *output_sample_rate = audio_hardware_config_->GetOutputSampleRate();
-void WebRTCAudioDeviceTest::OnGetHardwareInputChannelLayout(
- media::ChannelLayout* layout) {
- EXPECT_TRUE(audio_util_callback_);
- *layout = !audio_util_callback_ ? media::CHANNEL_LAYOUT_NONE :
- audio_util_callback_->GetAudioInputHardwareChannelLayout(
- media::AudioManagerBase::kDefaultDeviceId);
+ // TODO(henrika): add support for all available input devices.
+ *input_sample_rate = audio_hardware_config_->GetInputSampleRate();
+ *input_channel_layout = audio_hardware_config_->GetInputChannelLayout();
}
// IPC::Listener implementation.
@@ -310,12 +300,8 @@ bool WebRTCAudioDeviceTest::OnMessageReceived(const IPC::Message& message) {
bool handled ALLOW_UNUSED = true;
bool message_is_ok = true;
IPC_BEGIN_MESSAGE_MAP_EX(WebRTCAudioDeviceTest, message, message_is_ok)
- IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareSampleRate,
- OnGetHardwareSampleRate)
- IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputSampleRate,
- OnGetHardwareInputSampleRate)
- IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputChannelLayout,
- OnGetHardwareInputChannelLayout)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_GetAudioHardwareConfig,
+ OnGetAudioHardwareConfig)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
« no previous file with comments | « content/test/webrtc_audio_device_test.h ('k') | media/audio/audio_output_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698