OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/speech_recognition_audio_sink.h" | 5 #include "content/renderer/media/speech_recognition_audio_sink.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <utility> | 10 #include <utility> |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 const MediaStreamType device_type, | 276 const MediaStreamType device_type, |
277 blink::WebMediaStreamTrack* blink_track) { | 277 blink::WebMediaStreamTrack* blink_track) { |
278 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( | 278 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( |
279 WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); | 279 WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); |
280 std::unique_ptr<WebRtcLocalAudioTrack> native_track( | 280 std::unique_ptr<WebRtcLocalAudioTrack> native_track( |
281 new WebRtcLocalAudioTrack(adapter.get())); | 281 new WebRtcLocalAudioTrack(adapter.get())); |
282 blink::WebMediaStreamSource blink_audio_source; | 282 blink::WebMediaStreamSource blink_audio_source; |
283 blink_audio_source.initialize(base::UTF8ToUTF16("dummy_source_id"), | 283 blink_audio_source.initialize(base::UTF8ToUTF16("dummy_source_id"), |
284 blink::WebMediaStreamSource::TypeAudio, | 284 blink::WebMediaStreamSource::TypeAudio, |
285 base::UTF8ToUTF16("dummy_source_name"), | 285 base::UTF8ToUTF16("dummy_source_name"), |
286 false /* remote */, true /* readonly */); | 286 false /* remote */); |
287 MediaStreamSource::SourceStoppedCallback cb; | 287 MediaStreamSource::SourceStoppedCallback cb; |
288 blink_audio_source.setExtraData(new MediaStreamAudioSource( | 288 blink_audio_source.setExtraData(new MediaStreamAudioSource( |
289 -1, StreamDeviceInfo(device_type, "Mock device", "mock_device_id"), cb, | 289 -1, StreamDeviceInfo(device_type, "Mock device", "mock_device_id"), cb, |
290 nullptr)); | 290 nullptr)); |
291 blink_track->initialize(blink::WebString::fromUTF8("dummy_track"), | 291 blink_track->initialize(blink::WebString::fromUTF8("dummy_track"), |
292 blink_audio_source); | 292 blink_audio_source); |
293 blink_track->setExtraData(native_track.release()); | 293 blink_track->setExtraData(native_track.release()); |
294 } | 294 } |
295 | 295 |
296 // Emulates an audio capture device capturing data from the source. | 296 // Emulates an audio capture device capturing data from the source. |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 const uint32_t buffers_per_notification = Initialize(44100, 441, 16000, 1600); | 521 const uint32_t buffers_per_notification = Initialize(44100, 441, 16000, 1600); |
522 AssertConsumedBuffers(0U); | 522 AssertConsumedBuffers(0U); |
523 CaptureAudioAndAssertConsumedBuffers(buffers_per_notification, 1U); | 523 CaptureAudioAndAssertConsumedBuffers(buffers_per_notification, 1U); |
524 EXPECT_CALL(*this, StoppedCallback()).Times(1); | 524 EXPECT_CALL(*this, StoppedCallback()).Times(1); |
525 | 525 |
526 native_track()->Stop(); | 526 native_track()->Stop(); |
527 CaptureAudioAndAssertConsumedBuffers(buffers_per_notification, 1U); | 527 CaptureAudioAndAssertConsumedBuffers(buffers_per_notification, 1U); |
528 } | 528 } |
529 | 529 |
530 } // namespace content | 530 } // namespace content |
OLD | NEW |