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

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

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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/renderer/media/audio_track_recorder.h" 5 #include "content/renderer/media/audio_track_recorder.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "content/renderer/media/media_stream_audio_source.h" 13 #include "content/renderer/media/media_stream_audio_source.h"
14 #include "content/renderer/media/mock_media_constraint_factory.h"
14 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" 15 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h"
15 #include "content/renderer/media/webrtc_local_audio_track.h" 16 #include "content/renderer/media/webrtc_local_audio_track.h"
16 #include "media/audio/simple_sources.h" 17 #include "media/audio/simple_sources.h"
17 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "third_party/WebKit/public/web/WebHeap.h" 20 #include "third_party/WebKit/public/web/WebHeap.h"
20 #include "third_party/opus/src/include/opus.h" 21 #include "third_party/opus/src/include/opus.h"
21 22
22 using ::testing::_; 23 using ::testing::_;
23 using ::testing::DoAll; 24 using ::testing::DoAll;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 202
202 // Decoder for verifying data was properly encoded. 203 // Decoder for verifying data was properly encoded.
203 OpusDecoder* opus_decoder_; 204 OpusDecoder* opus_decoder_;
204 scoped_ptr<float[]> buffer_; 205 scoped_ptr<float[]> buffer_;
205 206
206 private: 207 private:
207 // Prepares a blink track of a given MediaStreamType and attaches the native 208 // Prepares a blink track of a given MediaStreamType and attaches the native
208 // track, which can be used to capture audio data and pass it to the producer. 209 // track, which can be used to capture audio data and pass it to the producer.
209 // Adapted from media::WebRTCLocalAudioSourceProviderTest. 210 // Adapted from media::WebRTCLocalAudioSourceProviderTest.
210 void PrepareBlinkTrack() { 211 void PrepareBlinkTrack() {
212 MockMediaConstraintFactory constraint_factory;
213 scoped_refptr<WebRtcAudioCapturer> capturer(
214 WebRtcAudioCapturer::CreateCapturer(
215 -1, StreamDeviceInfo(),
216 constraint_factory.CreateWebMediaConstraints(), NULL, NULL));
211 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( 217 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter(
212 WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); 218 WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
213 scoped_ptr<WebRtcLocalAudioTrack> native_track( 219 scoped_ptr<WebRtcLocalAudioTrack> native_track(
214 new WebRtcLocalAudioTrack(adapter.get())); 220 new WebRtcLocalAudioTrack(adapter.get(), capturer, NULL));
215 blink::WebMediaStreamSource audio_source; 221 blink::WebMediaStreamSource audio_source;
216 audio_source.initialize(base::UTF8ToUTF16("dummy_source_id"), 222 audio_source.initialize(base::UTF8ToUTF16("dummy_source_id"),
217 blink::WebMediaStreamSource::TypeAudio, 223 blink::WebMediaStreamSource::TypeAudio,
218 base::UTF8ToUTF16("dummy_source_name"), 224 base::UTF8ToUTF16("dummy_source_name"),
219 false /* remote */, true /* readonly */); 225 false /* remote */, true /* readonly */);
220 blink_track_.initialize(blink::WebString::fromUTF8("audio_track"), 226 blink_track_.initialize(blink::WebString::fromUTF8("audio_track"),
221 audio_source); 227 audio_source);
222 blink_track_.setExtraData(native_track.release()); 228 blink_track_.setExtraData(native_track.release());
223 } 229 }
224 230
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 base::TimeTicks::Now()); 282 base::TimeTicks::Now());
277 } 283 }
278 284
279 run_loop.Run(); 285 run_loop.Run();
280 Mock::VerifyAndClearExpectations(this); 286 Mock::VerifyAndClearExpectations(this);
281 } 287 }
282 288
283 INSTANTIATE_TEST_CASE_P(, AudioTrackRecorderTest, ValuesIn(kATRTestParams)); 289 INSTANTIATE_TEST_CASE_P(, AudioTrackRecorderTest, ValuesIn(kATRTestParams));
284 290
285 } // namespace content 291 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/audio_track_recorder.cc ('k') | content/renderer/media/media_recorder_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698