2013-03-15 13:29:17 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2015-11-26 04:44:54 -08:00
|
|
|
#ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_OPUS_TEST_H_
|
|
|
|
|
#define WEBRTC_MODULES_AUDIO_CODING_TEST_OPUS_TEST_H_
|
2013-03-15 13:29:17 +00:00
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
2015-02-26 14:34:55 +00:00
|
|
|
#include "webrtc/base/scoped_ptr.h"
|
2015-11-18 23:07:57 +01:00
|
|
|
#include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h"
|
2015-11-26 04:44:54 -08:00
|
|
|
#include "webrtc/modules/audio_coding/acm2/acm_resampler.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/ACMTest.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/Channel.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/PCMFile.h"
|
|
|
|
|
#include "webrtc/modules/audio_coding/test/TestStereo.h"
|
2013-03-15 13:29:17 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
class OpusTest : public ACMTest {
|
|
|
|
|
public:
|
2014-04-17 08:29:10 +00:00
|
|
|
OpusTest();
|
2013-03-15 13:29:17 +00:00
|
|
|
~OpusTest();
|
|
|
|
|
|
|
|
|
|
void Perform();
|
2013-09-13 23:06:59 +00:00
|
|
|
|
2013-03-15 13:29:17 +00:00
|
|
|
private:
|
Misc. small cleanups.
* Better param names
* Avoid using negative values for (bogus) placeholder channel counts (mostly in tests). Since channels will be changing to size_t, negative values will be illegal; it's sufficient to use 0 in these cases.
* Use arraysize()
* Use size_t for counting frames, samples, blocks, buffers, and bytes -- most of these are already size_t in most places, this just fixes some stragglers
* reinterpret_cast<int64_t>(void*) is not necessarily safe; use uintptr_t instead
* Remove unnecessary code, e.g. dead code, needlessly long/repetitive code, or function overrides that exactly match the base definition
* Fix indenting
* Use uint32_t for timestamps (matching how it's already a uint32_t in most places)
* Spelling
* RTC_CHECK_EQ(expected, actual)
* Rewrap
* Use .empty()
* Be more pedantic about matching int/int32_t/
* Remove pointless consts on input parameters to functions
* Add missing sanity checks
All this was found in the course of constructing https://codereview.webrtc.org/1316523002/ , and is being landed separately first.
BUG=none
TEST=none
Review URL: https://codereview.webrtc.org/1534193008
Cr-Commit-Position: refs/heads/master@{#11191}
2016-01-08 13:50:27 -08:00
|
|
|
void Run(TestPackStereo* channel,
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
size_t channels,
|
Misc. small cleanups.
* Better param names
* Avoid using negative values for (bogus) placeholder channel counts (mostly in tests). Since channels will be changing to size_t, negative values will be illegal; it's sufficient to use 0 in these cases.
* Use arraysize()
* Use size_t for counting frames, samples, blocks, buffers, and bytes -- most of these are already size_t in most places, this just fixes some stragglers
* reinterpret_cast<int64_t>(void*) is not necessarily safe; use uintptr_t instead
* Remove unnecessary code, e.g. dead code, needlessly long/repetitive code, or function overrides that exactly match the base definition
* Fix indenting
* Use uint32_t for timestamps (matching how it's already a uint32_t in most places)
* Spelling
* RTC_CHECK_EQ(expected, actual)
* Rewrap
* Use .empty()
* Be more pedantic about matching int/int32_t/
* Remove pointless consts on input parameters to functions
* Add missing sanity checks
All this was found in the course of constructing https://codereview.webrtc.org/1316523002/ , and is being landed separately first.
BUG=none
TEST=none
Review URL: https://codereview.webrtc.org/1534193008
Cr-Commit-Position: refs/heads/master@{#11191}
2016-01-08 13:50:27 -08:00
|
|
|
int bitrate,
|
|
|
|
|
size_t frame_length,
|
2013-03-15 13:29:17 +00:00
|
|
|
int percent_loss = 0);
|
|
|
|
|
|
|
|
|
|
void OpenOutFile(int test_number);
|
|
|
|
|
|
2015-02-26 14:34:55 +00:00
|
|
|
rtc::scoped_ptr<AudioCodingModule> acm_receiver_;
|
2013-03-15 13:29:17 +00:00
|
|
|
TestPackStereo* channel_a2b_;
|
|
|
|
|
PCMFile in_file_stereo_;
|
|
|
|
|
PCMFile in_file_mono_;
|
|
|
|
|
PCMFile out_file_;
|
2013-08-08 11:01:07 +00:00
|
|
|
PCMFile out_file_standalone_;
|
2013-03-15 13:29:17 +00:00
|
|
|
int counter_;
|
|
|
|
|
uint8_t payload_type_;
|
Misc. small cleanups.
* Better param names
* Avoid using negative values for (bogus) placeholder channel counts (mostly in tests). Since channels will be changing to size_t, negative values will be illegal; it's sufficient to use 0 in these cases.
* Use arraysize()
* Use size_t for counting frames, samples, blocks, buffers, and bytes -- most of these are already size_t in most places, this just fixes some stragglers
* reinterpret_cast<int64_t>(void*) is not necessarily safe; use uintptr_t instead
* Remove unnecessary code, e.g. dead code, needlessly long/repetitive code, or function overrides that exactly match the base definition
* Fix indenting
* Use uint32_t for timestamps (matching how it's already a uint32_t in most places)
* Spelling
* RTC_CHECK_EQ(expected, actual)
* Rewrap
* Use .empty()
* Be more pedantic about matching int/int32_t/
* Remove pointless consts on input parameters to functions
* Add missing sanity checks
All this was found in the course of constructing https://codereview.webrtc.org/1316523002/ , and is being landed separately first.
BUG=none
TEST=none
Review URL: https://codereview.webrtc.org/1534193008
Cr-Commit-Position: refs/heads/master@{#11191}
2016-01-08 13:50:27 -08:00
|
|
|
uint32_t rtp_timestamp_;
|
2014-04-17 08:29:10 +00:00
|
|
|
acm2::ACMResampler resampler_;
|
2013-03-15 13:29:17 +00:00
|
|
|
WebRtcOpusEncInst* opus_mono_encoder_;
|
|
|
|
|
WebRtcOpusEncInst* opus_stereo_encoder_;
|
2013-08-08 11:01:07 +00:00
|
|
|
WebRtcOpusDecInst* opus_mono_decoder_;
|
|
|
|
|
WebRtcOpusDecInst* opus_stereo_decoder_;
|
2013-03-15 13:29:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2015-11-26 04:44:54 -08:00
|
|
|
#endif // WEBRTC_MODULES_AUDIO_CODING_TEST_OPUS_TEST_H_
|