| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/memory/weak_ptr.h" | 5 #include "base/memory/weak_ptr.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/threading/thread_task_runner_handle.h" | 7 #include "base/threading/thread_task_runner_handle.h" |
| 8 #include "content/public/renderer/media_stream_audio_sink.h" | 8 #include "content/public/renderer/media_stream_audio_sink.h" |
| 9 #include "content/renderer/media/media_stream_audio_track.h" | 9 #include "content/renderer/media/media_stream_audio_track.h" |
| 10 #include "content/renderer/media_capture_from_element/html_audio_element_capture
r_source.h" | 10 #include "content/renderer/media_capture_from_element/html_audio_element_capture
r_source.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void SetUp() final { | 73 void SetUp() final { |
| 74 const media::AudioParameters params( | 74 const media::AudioParameters params( |
| 75 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 75 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 76 media::GuessChannelLayout(kNumChannelsForTest), | 76 media::GuessChannelLayout(kNumChannelsForTest), |
| 77 kAudioTrackSampleRate /* sample_rate */, 16 /* bits_per_sample */, | 77 kAudioTrackSampleRate /* sample_rate */, 16 /* bits_per_sample */, |
| 78 kAudioTrackSamplesPerBuffer /* frames_per_buffer */); | 78 kAudioTrackSamplesPerBuffer /* frames_per_buffer */); |
| 79 audio_source_->Initialize(params, &fake_callback_); | 79 audio_source_->Initialize(params, &fake_callback_); |
| 80 | 80 |
| 81 blink_audio_source_.initialize(blink::WebString::fromUTF8("audio_id"), | 81 blink_audio_source_.initialize(blink::WebString::fromUTF8("audio_id"), |
| 82 blink::WebMediaStreamSource::TypeAudio, | 82 blink::WebMediaStreamSource::TypeAudio, |
| 83 blink::WebString::fromUTF8("audio_track"), | 83 blink::WebString::fromUTF8("audio_track")); |
| 84 false /* remote */); | |
| 85 blink_audio_track_.initialize(blink_audio_source_.id(), | 84 blink_audio_track_.initialize(blink_audio_source_.id(), |
| 86 blink_audio_source_); | 85 blink_audio_source_); |
| 87 | 86 |
| 88 // |blink_audio_source_| takes ownership of HtmlAudioElementCapturerSource. | 87 // |blink_audio_source_| takes ownership of HtmlAudioElementCapturerSource. |
| 89 blink_audio_source_.setExtraData( | 88 blink_audio_source_.setExtraData( |
| 90 new HtmlAudioElementCapturerSource(audio_source_.get())); | 89 new HtmlAudioElementCapturerSource(audio_source_.get())); |
| 91 ASSERT_TRUE(source()->ConnectToTrack(blink_audio_track_)); | 90 ASSERT_TRUE(source()->ConnectToTrack(blink_audio_track_)); |
| 92 } | 91 } |
| 93 | 92 |
| 94 void TearDown() override { | 93 void TearDown() override { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 std::unique_ptr<media::AudioBus> bus = media::AudioBus::Create( | 146 std::unique_ptr<media::AudioBus> bus = media::AudioBus::Create( |
| 148 kNumChannelsForTest, kAudioTrackSamplesPerBuffer); | 147 kNumChannelsForTest, kAudioTrackSamplesPerBuffer); |
| 149 InjectAudio(bus.get()); | 148 InjectAudio(bus.get()); |
| 150 run_loop.Run(); | 149 run_loop.Run(); |
| 151 | 150 |
| 152 track()->Stop(); | 151 track()->Stop(); |
| 153 track()->RemoveSink(&sink); | 152 track()->RemoveSink(&sink); |
| 154 } | 153 } |
| 155 | 154 |
| 156 } // namespace content | 155 } // namespace content |
| OLD | NEW |