OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #include "webrtc/modules/audio_processing/aec_dump/capture_stream_info.h" | |
12 | |
13 namespace webrtc { | |
14 CaptureStreamInfo::CaptureStreamInfo(std::unique_ptr<WriteToFileTask> task) | |
15 : task_(std::move(task)) { | |
16 RTC_DCHECK(task_); | |
17 task_->GetEvent()->set_type(audioproc::Event::STREAM); | |
18 } | |
19 | |
20 CaptureStreamInfo::~CaptureStreamInfo() = default; | |
21 | |
22 void CaptureStreamInfo::AddInput(const FloatAudioFrame& src) { | |
23 RTC_DCHECK(task_); | |
24 auto* stream = task_->GetEvent()->mutable_stream(); | |
25 | |
26 for (size_t i = 0; i < src.num_channels(); ++i) { | |
27 const auto& channel_view = src.channel(i); | |
28 stream->add_input_channel(channel_view.begin(), | |
29 sizeof(float) * channel_view.size()); | |
30 } | |
31 } | |
32 | |
33 void CaptureStreamInfo::AddOutput(const FloatAudioFrame& src) { | |
34 RTC_DCHECK(task_); | |
35 auto* stream = task_->GetEvent()->mutable_stream(); | |
36 | |
37 for (size_t i = 0; i < src.num_channels(); ++i) { | |
38 const auto& channel_view = src.channel(i); | |
39 stream->add_output_channel(channel_view.begin(), | |
40 sizeof(float) * channel_view.size()); | |
41 } | |
42 } | |
43 | |
44 void CaptureStreamInfo::AddInput(const AudioFrame& frame) { | |
45 RTC_DCHECK(task_); | |
46 audioproc::Stream* stream = task_->GetEvent()->mutable_stream(); | |
peah-webrtc
2017/05/16 06:30:38
auto* to conform to 24 and 35?
aleloi
2017/05/16 20:10:17
Done.
| |
47 const size_t data_size = | |
48 sizeof(int16_t) * frame.samples_per_channel_ * frame.num_channels_; | |
49 stream->set_input_data(frame.data_, data_size); | |
50 } | |
51 | |
52 void CaptureStreamInfo::AddOutput(const AudioFrame& frame) { | |
53 RTC_DCHECK(task_); | |
54 audioproc::Stream* stream = task_->GetEvent()->mutable_stream(); | |
peah-webrtc
2017/05/16 06:30:38
auto* to conform to 24 and 35?
aleloi
2017/05/16 20:10:17
Done.
| |
55 const size_t data_size = | |
56 sizeof(int16_t) * frame.samples_per_channel_ * frame.num_channels_; | |
57 stream->set_output_data(frame.data_, data_size); | |
58 } | |
59 | |
60 void CaptureStreamInfo::AddAudioProcessingState( | |
61 const AudioProcessingState& state) { | |
62 RTC_DCHECK(task_); | |
63 auto* stream = task_->GetEvent()->mutable_stream(); | |
64 stream->set_delay(state.delay); | |
65 stream->set_drift(state.drift); | |
66 stream->set_level(state.level); | |
67 stream->set_keypress(state.keypress); | |
68 } | |
69 } // namespace webrtc | |
OLD | NEW |