OLD | NEW |
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 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 public: | 80 public: |
81 MockEncodeHelper() : write_payload_(false), payload_(NULL) { | 81 MockEncodeHelper() : write_payload_(false), payload_(NULL) { |
82 memset(&info_, 0, sizeof(info_)); | 82 memset(&info_, 0, sizeof(info_)); |
83 } | 83 } |
84 | 84 |
85 AudioEncoder::EncodedInfo Encode(uint32_t timestamp, | 85 AudioEncoder::EncodedInfo Encode(uint32_t timestamp, |
86 const int16_t* audio, | 86 const int16_t* audio, |
87 size_t max_encoded_bytes, | 87 size_t max_encoded_bytes, |
88 uint8_t* encoded) { | 88 uint8_t* encoded) { |
89 if (write_payload_) { | 89 if (write_payload_) { |
90 CHECK(encoded); | 90 RTC_CHECK(encoded); |
91 CHECK_LE(info_.encoded_bytes, max_encoded_bytes); | 91 RTC_CHECK_LE(info_.encoded_bytes, max_encoded_bytes); |
92 memcpy(encoded, payload_, info_.encoded_bytes); | 92 memcpy(encoded, payload_, info_.encoded_bytes); |
93 } | 93 } |
94 return info_; | 94 return info_; |
95 } | 95 } |
96 | 96 |
97 AudioEncoder::EncodedInfo info_; | 97 AudioEncoder::EncodedInfo info_; |
98 bool write_payload_; | 98 bool write_payload_; |
99 uint8_t* payload_; | 99 uint8_t* payload_; |
100 }; | 100 }; |
101 | 101 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 config.speech_encoder = NULL; | 325 config.speech_encoder = NULL; |
326 EXPECT_DEATH(red = new AudioEncoderCopyRed(config), | 326 EXPECT_DEATH(red = new AudioEncoderCopyRed(config), |
327 "Speech encoder not provided."); | 327 "Speech encoder not provided."); |
328 // The delete operation is needed to avoid leak reports from memcheck. | 328 // The delete operation is needed to avoid leak reports from memcheck. |
329 delete red; | 329 delete red; |
330 } | 330 } |
331 | 331 |
332 #endif // GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) | 332 #endif // GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
333 | 333 |
334 } // namespace webrtc | 334 } // namespace webrtc |
OLD | NEW |