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

Side by Side Diff: content/renderer/media/webrtc_local_audio_source_provider_unittest.cc

Issue 518433002: Revert of Revert of Remove the last piece of deprecated synchronous IO code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
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 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/renderer/media/mock_media_constraint_factory.h" 7 #include "content/renderer/media/mock_media_constraint_factory.h"
8 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" 8 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h"
9 #include "content/renderer/media/webrtc_audio_capturer.h" 9 #include "content/renderer/media/webrtc_audio_capturer.h"
10 #include "content/renderer/media/webrtc_local_audio_source_provider.h" 10 #include "content/renderer/media/webrtc_local_audio_source_provider.h"
11 #include "content/renderer/media/webrtc_local_audio_track.h" 11 #include "content/renderer/media/webrtc_local_audio_track.h"
12 #include "media/audio/audio_parameters.h" 12 #include "media/audio/audio_parameters.h"
13 #include "media/base/audio_bus.h" 13 #include "media/base/audio_bus.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 class WebRtcLocalAudioSourceProviderTest : public testing::Test { 19 class WebRtcLocalAudioSourceProviderTest : public testing::Test {
20 protected: 20 protected:
21 virtual void SetUp() OVERRIDE { 21 virtual void SetUp() OVERRIDE {
22 source_params_.Reset(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, 22 source_params_.Reset(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
23 media::CHANNEL_LAYOUT_MONO, 1, 0, 48000, 16, 480); 23 media::CHANNEL_LAYOUT_MONO, 1, 48000, 16, 480);
24 sink_params_.Reset( 24 sink_params_.Reset(
25 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, 25 media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
26 media::CHANNEL_LAYOUT_STEREO, 2, 0, 44100, 16, 26 media::CHANNEL_LAYOUT_STEREO, 2, 44100, 16,
27 WebRtcLocalAudioSourceProvider::kWebAudioRenderBufferSize); 27 WebRtcLocalAudioSourceProvider::kWebAudioRenderBufferSize);
28 const int length = 28 const int length =
29 source_params_.frames_per_buffer() * source_params_.channels(); 29 source_params_.frames_per_buffer() * source_params_.channels();
30 source_data_.reset(new int16[length]); 30 source_data_.reset(new int16[length]);
31 sink_bus_ = media::AudioBus::Create(sink_params_); 31 sink_bus_ = media::AudioBus::Create(sink_params_);
32 MockMediaConstraintFactory constraint_factory; 32 MockMediaConstraintFactory constraint_factory;
33 scoped_refptr<WebRtcAudioCapturer> capturer( 33 scoped_refptr<WebRtcAudioCapturer> capturer(
34 WebRtcAudioCapturer::CreateCapturer( 34 WebRtcAudioCapturer::CreateCapturer(
35 -1, StreamDeviceInfo(), 35 -1, StreamDeviceInfo(),
36 constraint_factory.CreateWebMediaConstraints(), NULL, NULL)); 36 constraint_factory.CreateWebMediaConstraints(), NULL, NULL));
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // Stop the audio track. 129 // Stop the audio track.
130 WebRtcLocalAudioTrack* native_track = static_cast<WebRtcLocalAudioTrack*>( 130 WebRtcLocalAudioTrack* native_track = static_cast<WebRtcLocalAudioTrack*>(
131 MediaStreamTrack::GetTrack(blink_track_)); 131 MediaStreamTrack::GetTrack(blink_track_));
132 native_track->Stop(); 132 native_track->Stop();
133 133
134 // Delete the source provider. 134 // Delete the source provider.
135 source_provider_.reset(); 135 source_provider_.reset();
136 } 136 }
137 137
138 } // namespace content 138 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698