Opus send rate overflows if over 65 kbps
The member holding the send rate for Opus had too low resolution for rates above ~65 kbps. I've added a test that checks if the average rate in a Opus test is in the right range. The test fails before my fix, and now passes. BUG=3267 R=henrik.lundin@webrtc.org, kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/12579004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6344 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
b51d3ea593
commit
65d61c3924
@ -47,7 +47,7 @@ class ACMOpus : public ACMGenericCodec {
|
||||
|
||||
WebRtcOpusEncInst* encoder_inst_ptr_;
|
||||
uint16_t sample_freq_;
|
||||
uint16_t bitrate_;
|
||||
int32_t bitrate_;
|
||||
int channels_;
|
||||
|
||||
bool fec_enabled_;
|
||||
|
@ -807,6 +807,8 @@ void TestStereo::Run(TestPackStereo* channel, int in_channels, int out_channels,
|
||||
uint32_t time_stamp_diff;
|
||||
channel->reset_payload_size();
|
||||
int error_count = 0;
|
||||
int variable_bytes = 0;
|
||||
int variable_packets = 0;
|
||||
|
||||
while (1) {
|
||||
// Simulate packet loss by setting |packet_loss_| to "true" in
|
||||
@ -838,11 +840,16 @@ void TestStereo::Run(TestPackStereo* channel, int in_channels, int out_channels,
|
||||
// Run sender side of ACM
|
||||
EXPECT_GT(acm_a_->Process(), -1);
|
||||
|
||||
// Verify that the received packet size matches the settings
|
||||
// Verify that the received packet size matches the settings.
|
||||
rec_size = channel->payload_size();
|
||||
if ((0 < rec_size) & (rec_size < 65535)) {
|
||||
// Opus is variable rate, skip this test.
|
||||
if (strcmp(send_codec_name_, "opus")) {
|
||||
if (strcmp(send_codec_name_, "opus") == 0) {
|
||||
// Opus is a variable rate codec, hence calculate the average packet
|
||||
// size, and later make sure the average is in the right range.
|
||||
variable_bytes += rec_size;
|
||||
variable_packets++;
|
||||
} else {
|
||||
// For fixed rate codecs, check that packet size is correct.
|
||||
if ((rec_size != pack_size_bytes_ * out_channels)
|
||||
&& (pack_size_bytes_ < 65535)) {
|
||||
error_count++;
|
||||
@ -866,6 +873,13 @@ void TestStereo::Run(TestPackStereo* channel, int in_channels, int out_channels,
|
||||
|
||||
EXPECT_EQ(0, error_count);
|
||||
|
||||
// Check that packet size is in the right range for variable rate codecs,
|
||||
// such as Opus.
|
||||
if (variable_packets > 0) {
|
||||
variable_bytes /= variable_packets;
|
||||
EXPECT_NEAR(variable_bytes, pack_size_bytes_, 3);
|
||||
}
|
||||
|
||||
if (in_file_mono_->EndOfFile()) {
|
||||
in_file_mono_->Rewind();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user