| 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/capturefromelement/html_audio_element_capturer_
source.h" | 9 #include "content/renderer/media/capturefromelement/html_audio_element_capturer_
source.h" |
| 10 #include "content/renderer/media/media_stream_audio_track.h" | 10 #include "content/renderer/media/media_stream_audio_track.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 */); |
| 84 blink_audio_track_.initialize(blink_audio_source_.id(), | 85 blink_audio_track_.initialize(blink_audio_source_.id(), |
| 85 blink_audio_source_); | 86 blink_audio_source_); |
| 86 | 87 |
| 87 // |blink_audio_source_| takes ownership of HtmlAudioElementCapturerSource. | 88 // |blink_audio_source_| takes ownership of HtmlAudioElementCapturerSource. |
| 88 blink_audio_source_.setExtraData( | 89 blink_audio_source_.setExtraData( |
| 89 new HtmlAudioElementCapturerSource(audio_source_.get())); | 90 new HtmlAudioElementCapturerSource(audio_source_.get())); |
| 90 ASSERT_TRUE(source()->ConnectToTrack(blink_audio_track_)); | 91 ASSERT_TRUE(source()->ConnectToTrack(blink_audio_track_)); |
| 91 } | 92 } |
| 92 | 93 |
| 93 void TearDown() override { | 94 void TearDown() override { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 std::unique_ptr<media::AudioBus> bus = media::AudioBus::Create( | 147 std::unique_ptr<media::AudioBus> bus = media::AudioBus::Create( |
| 147 kNumChannelsForTest, kAudioTrackSamplesPerBuffer); | 148 kNumChannelsForTest, kAudioTrackSamplesPerBuffer); |
| 148 InjectAudio(bus.get()); | 149 InjectAudio(bus.get()); |
| 149 run_loop.Run(); | 150 run_loop.Run(); |
| 150 | 151 |
| 151 track()->Stop(); | 152 track()->Stop(); |
| 152 track()->RemoveSink(&sink); | 153 track()->RemoveSink(&sink); |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace content | 156 } // namespace content |
| OLD | NEW |