Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: webrtc/modules/audio_processing/aec_dump/capture_stream_info_impl.cc

Issue 2838133003: Implementation of new AecDump interface. (Closed)
Patch Set: Complete and tested AecDump implementation. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_impl.h"
12
13 namespace webrtc {
14 CaptureStreamInfoImpl::CaptureStreamInfoImpl(
15 std::unique_ptr<audioproc::Event> event)
16 : event_(std::move(event)) {
17 RTC_DCHECK(event_);
18 event_->set_type(audioproc::Event::STREAM);
19 }
20
21 CaptureStreamInfoImpl::~CaptureStreamInfoImpl() = default;
22
23 void CaptureStreamInfoImpl::AddInput(FloatAudioFrame src) {
24 auto* stream = event_->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 CaptureStreamInfoImpl::AddOutput(FloatAudioFrame src) {
34 auto* stream = event_->mutable_stream();
35
36 for (size_t i = 0; i < src.num_channels(); ++i) {
37 const auto& channel_view = src.channel(i);
38 stream->add_output_channel(channel_view.begin(),
39 sizeof(float) * channel_view.size());
40 }
41 }
42
43 void CaptureStreamInfoImpl::AddInput(const AudioFrame& frame) {
44 audioproc::Stream* stream = event_->mutable_stream();
45 const size_t data_size =
46 sizeof(int16_t) * frame.samples_per_channel_ * frame.num_channels_;
47 stream->set_input_data(frame.data_, data_size);
48 }
49
50 void CaptureStreamInfoImpl::AddOutput(const AudioFrame& frame) {
51 audioproc::Stream* stream = event_->mutable_stream();
52 const size_t data_size =
53 sizeof(int16_t) * frame.samples_per_channel_ * frame.num_channels_;
54 stream->set_output_data(frame.data_, data_size);
55 }
56
57 void CaptureStreamInfoImpl::set_delay(int delay) {
58 event_->mutable_stream()->set_delay(delay);
59 }
60 void CaptureStreamInfoImpl::set_drift(int drift) {
61 event_->mutable_stream()->set_drift(drift);
62 }
63 void CaptureStreamInfoImpl::set_level(int level) {
64 event_->mutable_stream()->set_level(level);
65 }
66 void CaptureStreamInfoImpl::set_keypress(bool keypress) {
67 event_->mutable_stream()->set_keypress(keypress);
68 }
69 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698