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 "remoting/protocol/webrtc_audio_source_adapter.h" | 5 #include "remoting/protocol/webrtc_audio_source_adapter.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
10 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
11 #include "remoting/proto/audio.pb.h" | 13 #include "remoting/proto/audio.pb.h" |
12 #include "remoting/protocol/audio_source.h" | 14 #include "remoting/protocol/audio_source.h" |
13 | 15 |
14 namespace remoting { | 16 namespace remoting { |
15 namespace protocol { | 17 namespace protocol { |
16 | 18 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 sampling_rate_, kChannels, samples_per_frame); | 139 sampling_rate_, kChannels, samples_per_frame); |
138 } | 140 } |
139 position += bytes_per_frame; | 141 position += bytes_per_frame; |
140 } | 142 } |
141 | 143 |
142 partial_frame_.assign(data.data() + position, data.data() + data.size()); | 144 partial_frame_.assign(data.data() + position, data.data() + data.size()); |
143 } | 145 } |
144 | 146 |
145 WebrtcAudioSourceAdapter::WebrtcAudioSourceAdapter( | 147 WebrtcAudioSourceAdapter::WebrtcAudioSourceAdapter( |
146 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) | 148 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) |
147 : audio_task_runner_(audio_task_runner), core_(new Core()) {} | 149 : audio_task_runner_(std::move(audio_task_runner)), core_(new Core()) {} |
148 | 150 |
149 WebrtcAudioSourceAdapter::~WebrtcAudioSourceAdapter() { | 151 WebrtcAudioSourceAdapter::~WebrtcAudioSourceAdapter() { |
150 audio_task_runner_->DeleteSoon(FROM_HERE, core_.release()); | 152 audio_task_runner_->DeleteSoon(FROM_HERE, core_.release()); |
151 } | 153 } |
152 | 154 |
153 void WebrtcAudioSourceAdapter::Start( | 155 void WebrtcAudioSourceAdapter::Start( |
154 std::unique_ptr<AudioSource> audio_source) { | 156 std::unique_ptr<AudioSource> audio_source) { |
155 audio_task_runner_->PostTask( | 157 audio_task_runner_->PostTask( |
156 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()), | 158 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()), |
157 base::Passed(&audio_source))); | 159 base::Passed(&audio_source))); |
(...skipping 26 matching lines...) Expand all Loading... |
184 core_->RemoveSink(sink); | 186 core_->RemoveSink(sink); |
185 } | 187 } |
186 | 188 |
187 void WebrtcAudioSourceAdapter::RegisterObserver( | 189 void WebrtcAudioSourceAdapter::RegisterObserver( |
188 webrtc::ObserverInterface* observer) {} | 190 webrtc::ObserverInterface* observer) {} |
189 void WebrtcAudioSourceAdapter::UnregisterObserver( | 191 void WebrtcAudioSourceAdapter::UnregisterObserver( |
190 webrtc::ObserverInterface* observer) {} | 192 webrtc::ObserverInterface* observer) {} |
191 | 193 |
192 } // namespace protocol | 194 } // namespace protocol |
193 } // namespace remoting | 195 } // namespace remoting |
OLD | NEW |