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

Side by Side Diff: webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.cc

Issue 2799033006: Injectable audio encoders: Moved audio encoder, factory and builtin factory to api/. (Closed)
Patch Set: More backwards-compatibility! 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) 2016 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_coding/codecs/mock/mock_audio_encoder.h"
12
13 namespace webrtc {
14
15 MockAudioEncoder::FakeEncoding::FakeEncoding(
16 const AudioEncoder::EncodedInfo& info)
17 : info_(info) { }
18
19 MockAudioEncoder::FakeEncoding::FakeEncoding(size_t encoded_bytes) {
20 info_.encoded_bytes = encoded_bytes;
21 }
22
23 AudioEncoder::EncodedInfo MockAudioEncoder::FakeEncoding::operator()(
24 uint32_t timestamp,
25 rtc::ArrayView<const int16_t> audio,
26 rtc::Buffer* encoded) {
27 encoded->SetSize(encoded->size() + info_.encoded_bytes);
28 return info_;
29 }
30
31 MockAudioEncoder::CopyEncoding::CopyEncoding(
32 AudioEncoder::EncodedInfo info,
33 rtc::ArrayView<const uint8_t> payload)
34 : info_(info), payload_(payload) { }
35
36 MockAudioEncoder::CopyEncoding::CopyEncoding(
37 rtc::ArrayView<const uint8_t> payload)
38 : payload_(payload) {
39 info_.encoded_bytes = payload_.size();
40 }
41
42 AudioEncoder::EncodedInfo MockAudioEncoder::CopyEncoding::operator()(
43 uint32_t timestamp,
44 rtc::ArrayView<const int16_t> audio,
45 rtc::Buffer* encoded) {
46 RTC_CHECK(encoded);
47 RTC_CHECK_LE(info_.encoded_bytes, payload_.size());
48 encoded->AppendData(payload_.data(), info_.encoded_bytes);
49 return info_;
50 }
51
52 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698