| OLD | NEW |
| 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 "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/renderer/media/media_stream_audio_source.h" | 10 #include "content/renderer/media/media_stream_audio_source.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 buffer_.reset(new float[max_frames_per_buffer_ * params.channels()]); | 121 buffer_.reset(new float[max_frames_per_buffer_ * params.channels()]); |
| 122 } | 122 } |
| 123 | 123 |
| 124 scoped_ptr<media::AudioBus> GetFirstSourceAudioBus() { | 124 scoped_ptr<media::AudioBus> GetFirstSourceAudioBus() { |
| 125 scoped_ptr<media::AudioBus> bus(media::AudioBus::Create( | 125 scoped_ptr<media::AudioBus> bus(media::AudioBus::Create( |
| 126 first_params_.channels(), | 126 first_params_.channels(), |
| 127 first_params_.sample_rate() * | 127 first_params_.sample_rate() * |
| 128 audio_track_recorder_->GetOpusBufferDuration( | 128 audio_track_recorder_->GetOpusBufferDuration( |
| 129 first_params_.sample_rate()) / | 129 first_params_.sample_rate()) / |
| 130 1000)); | 130 1000)); |
| 131 first_source_.OnMoreData(bus.get(), 0); | 131 first_source_.OnMoreData(bus.get(), 0, 0); |
| 132 return bus.Pass(); | 132 return bus.Pass(); |
| 133 } | 133 } |
| 134 scoped_ptr<media::AudioBus> GetSecondSourceAudioBus() { | 134 scoped_ptr<media::AudioBus> GetSecondSourceAudioBus() { |
| 135 scoped_ptr<media::AudioBus> bus(media::AudioBus::Create( | 135 scoped_ptr<media::AudioBus> bus(media::AudioBus::Create( |
| 136 second_params_.channels(), | 136 second_params_.channels(), |
| 137 second_params_.sample_rate() * | 137 second_params_.sample_rate() * |
| 138 audio_track_recorder_->GetOpusBufferDuration( | 138 audio_track_recorder_->GetOpusBufferDuration( |
| 139 second_params_.sample_rate()) / | 139 second_params_.sample_rate()) / |
| 140 1000)); | 140 1000)); |
| 141 second_source_.OnMoreData(bus.get(), 0); | 141 second_source_.OnMoreData(bus.get(), 0, 0); |
| 142 return bus.Pass(); | 142 return bus.Pass(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 MOCK_METHOD3(DoOnEncodedAudio, | 145 MOCK_METHOD3(DoOnEncodedAudio, |
| 146 void(const media::AudioParameters& params, | 146 void(const media::AudioParameters& params, |
| 147 std::string encoded_data, | 147 std::string encoded_data, |
| 148 base::TimeTicks timestamp)); | 148 base::TimeTicks timestamp)); |
| 149 | 149 |
| 150 void OnEncodedAudio(const media::AudioParameters& params, | 150 void OnEncodedAudio(const media::AudioParameters& params, |
| 151 scoped_ptr<std::string> encoded_data, | 151 scoped_ptr<std::string> encoded_data, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 .WillOnce(RunClosure(quit_closure)); | 244 .WillOnce(RunClosure(quit_closure)); |
| 245 audio_track_recorder_->OnData(*GetSecondSourceAudioBus(), time3); | 245 audio_track_recorder_->OnData(*GetSecondSourceAudioBus(), time3); |
| 246 | 246 |
| 247 run_loop.Run(); | 247 run_loop.Run(); |
| 248 Mock::VerifyAndClearExpectations(this); | 248 Mock::VerifyAndClearExpectations(this); |
| 249 } | 249 } |
| 250 | 250 |
| 251 INSTANTIATE_TEST_CASE_P(, AudioTrackRecorderTest, ValuesIn(kATRTestParams)); | 251 INSTANTIATE_TEST_CASE_P(, AudioTrackRecorderTest, ValuesIn(kATRTestParams)); |
| 252 | 252 |
| 253 } // namespace content | 253 } // namespace content |
| OLD | NEW |