Add GetChunkLength to LappedTransform.
R=andrew@webrtc.org Review URL: https://webrtc-codereview.appspot.com/56529004 Cr-Commit-Position: refs/heads/master@{#9301}
This commit is contained in:
parent
fec2c6d7eb
commit
9b720f7016
@ -57,6 +57,14 @@ class LappedTransform {
|
||||
// |out_chunk|. Both buffers are caller-owned.
|
||||
void ProcessChunk(const float* const* in_chunk, float* const* out_chunk);
|
||||
|
||||
// Get the chunk length.
|
||||
//
|
||||
// The chunk length is the number of samples per channel that must be passed
|
||||
// to ProcessChunk via the parameter in_chunk.
|
||||
//
|
||||
// Returns the same chunk_length passed to the LappedTransform constructor.
|
||||
int get_chunk_length() const { return chunk_length_; }
|
||||
|
||||
private:
|
||||
// Internal middleware callback, given to the blocker. Transforms each block
|
||||
// and hands it over to the processing method given at construction time.
|
||||
|
@ -177,5 +177,27 @@ TEST(LappedTransformTest, Callbacks) {
|
||||
ASSERT_EQ(kChunkLength / kBlockLength, call.block_num());
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
TEST(LappedTransformTest, get_chunk_length) {
|
||||
const int kBlockLength = 64;
|
||||
FftCheckerCallback call;
|
||||
const float window[kBlockLength] = {};
|
||||
|
||||
// Make sure that get_chunk_length returns the same value passed to the
|
||||
// LappedTransform constructor.
|
||||
{
|
||||
const int kExpectedChunkLength = 512;
|
||||
const LappedTransform trans(1, 1, kExpectedChunkLength, window,
|
||||
kBlockLength, kBlockLength, &call);
|
||||
|
||||
EXPECT_EQ(kExpectedChunkLength, trans.get_chunk_length());
|
||||
}
|
||||
{
|
||||
const int kExpectedChunkLength = 160;
|
||||
const LappedTransform trans(1, 1, kExpectedChunkLength, window,
|
||||
kBlockLength, kBlockLength, &call);
|
||||
|
||||
EXPECT_EQ(kExpectedChunkLength, trans.get_chunk_length());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
Loading…
Reference in New Issue
Block a user