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

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

Issue 1871003002: A few small cleanups of stuff caught by lint (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@remove-old-encode
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_MOCK_MOCK_AUDIO_ENCODER_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_MOCK_MOCK_AUDIO_ENCODER_H_
12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_MOCK_MOCK_AUDIO_ENCODER_H_ 12 #define WEBRTC_MODULES_AUDIO_CODING_CODECS_MOCK_MOCK_AUDIO_ENCODER_H_
13 13
14 #include <string>
15
14 #include "webrtc/base/array_view.h" 16 #include "webrtc/base/array_view.h"
15 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" 17 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
16 18
17 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
18 20
19 namespace webrtc { 21 namespace webrtc {
20 22
21 class MockAudioEncoder : public AudioEncoder { 23 class MockAudioEncoder : public AudioEncoder {
22 public: 24 public:
23 ~MockAudioEncoder() override { Die(); } 25 ~MockAudioEncoder() override { Die(); }
(...skipping 18 matching lines...) Expand all
42 // Note, we explicitly chose not to create a mock for the Encode method. 44 // Note, we explicitly chose not to create a mock for the Encode method.
43 MOCK_METHOD3(EncodeImpl, 45 MOCK_METHOD3(EncodeImpl,
44 EncodedInfo(uint32_t timestamp, 46 EncodedInfo(uint32_t timestamp,
45 rtc::ArrayView<const int16_t> audio, 47 rtc::ArrayView<const int16_t> audio,
46 rtc::Buffer* encoded)); 48 rtc::Buffer* encoded));
47 49
48 class FakeEncoding { 50 class FakeEncoding {
49 public: 51 public:
50 // Creates a functor that will return |info| and adjust the rtc::Buffer 52 // Creates a functor that will return |info| and adjust the rtc::Buffer
51 // given as input to it, so it is info.encoded_bytes larger. 53 // given as input to it, so it is info.encoded_bytes larger.
52 FakeEncoding(const AudioEncoder::EncodedInfo& info); 54 explicit FakeEncoding(const AudioEncoder::EncodedInfo& info);
53 55
54 // Shorthand version of the constructor above, for when only setting 56 // Shorthand version of the constructor above, for when only setting
55 // encoded_bytes in the EncodedInfo object matters. 57 // encoded_bytes in the EncodedInfo object matters.
56 FakeEncoding(size_t encoded_bytes); 58 explicit FakeEncoding(size_t encoded_bytes);
57 59
58 AudioEncoder::EncodedInfo operator()(uint32_t timestamp, 60 AudioEncoder::EncodedInfo operator()(uint32_t timestamp,
59 rtc::ArrayView<const int16_t> audio, 61 rtc::ArrayView<const int16_t> audio,
60 rtc::Buffer* encoded); 62 rtc::Buffer* encoded);
61 63
62 private: 64 private:
63 AudioEncoder::EncodedInfo info_; 65 AudioEncoder::EncodedInfo info_;
64 }; 66 };
65 67
66 class CopyEncoding { 68 class CopyEncoding {
67 public: 69 public:
68 // Creates a functor that will return |info| and append the data in the 70 // Creates a functor that will return |info| and append the data in the
69 // payload to the buffer given as input to it. Up to info.encoded_bytes are 71 // payload to the buffer given as input to it. Up to info.encoded_bytes are
70 // appended - make sure the payload is big enough! Since it uses an 72 // appended - make sure the payload is big enough! Since it uses an
71 // ArrayView, it _does not_ copy the payload. Make sure it doesn't fall out 73 // ArrayView, it _does not_ copy the payload. Make sure it doesn't fall out
72 // of scope! 74 // of scope!
73 CopyEncoding(AudioEncoder::EncodedInfo info, 75 CopyEncoding(AudioEncoder::EncodedInfo info,
74 rtc::ArrayView<const uint8_t> payload); 76 rtc::ArrayView<const uint8_t> payload);
75 77
76 // Shorthand version of the constructor above, for when you wish to append 78 // Shorthand version of the constructor above, for when you wish to append
77 // the whole payload and do not care about any EncodedInfo attribute other 79 // the whole payload and do not care about any EncodedInfo attribute other
78 // than encoded_bytes. 80 // than encoded_bytes.
79 CopyEncoding(rtc::ArrayView<const uint8_t> payload); 81 explicit CopyEncoding(rtc::ArrayView<const uint8_t> payload);
80 82
81 AudioEncoder::EncodedInfo operator()(uint32_t timestamp, 83 AudioEncoder::EncodedInfo operator()(uint32_t timestamp,
82 rtc::ArrayView<const int16_t> audio, 84 rtc::ArrayView<const int16_t> audio,
83 rtc::Buffer* encoded); 85 rtc::Buffer* encoded);
86
84 private: 87 private:
85 AudioEncoder::EncodedInfo info_; 88 AudioEncoder::EncodedInfo info_;
86 rtc::ArrayView<const uint8_t> payload_; 89 rtc::ArrayView<const uint8_t> payload_;
87 }; 90 };
88 }; 91 };
89 92
90 } // namespace webrtc 93 } // namespace webrtc
91 94
92 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_MOCK_MOCK_AUDIO_ENCODER_H_ 95 #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_MOCK_MOCK_AUDIO_ENCODER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698