-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creates boilerplate for LpcmDecoder tests
PiperOrigin-RevId: 631813725
- Loading branch information
1 parent
291f447
commit 1e8f6e9
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "iamf/cli/codec/lpcm_decoder.h" | ||
|
||
#include <cstdint> | ||
|
||
#include "gtest/gtest.h" | ||
#include "iamf/obu/codec_config.h" | ||
#include "iamf/obu/decoder_config/lpcm_decoder_config.h" | ||
#include "iamf/obu/obu_header.h" | ||
|
||
namespace iamf_tools { | ||
namespace { | ||
|
||
CodecConfigObu CreateCodecConfigObu(uint32_t num_samples_per_frame) { | ||
LpcmDecoderConfig lpcm_decoder_config; | ||
lpcm_decoder_config.sample_size_ = 16; | ||
lpcm_decoder_config.sample_rate_ = 48000; | ||
|
||
const CodecConfig codec_config = { | ||
.codec_id = CodecConfig::kCodecIdLpcm, | ||
.num_samples_per_frame = num_samples_per_frame, | ||
.audio_roll_distance = 0, | ||
.decoder_config = lpcm_decoder_config}; | ||
|
||
CodecConfigObu codec_config_obu(ObuHeader(), 0, codec_config); | ||
return codec_config_obu; | ||
}; | ||
|
||
TEST(LpcmDecoderTest, Construct) { | ||
uint32_t num_samples_per_frame = 1024; | ||
CodecConfigObu codec_config_obu = CreateCodecConfigObu(num_samples_per_frame); | ||
ASSERT_TRUE(codec_config_obu.Initialize().ok()); | ||
|
||
int number_of_channels = 11; | ||
|
||
LpcmDecoder lpcm_decoder(codec_config_obu, number_of_channels); | ||
} | ||
|
||
} // namespace | ||
} // namespace iamf_tools |