Opus mono/stereo on the same payloadtype, and fix of memory bug
During call setup Opus should always be signaled as a 48000 Hz stereo codec, not depending on what we plan to send, or how we plan to decode received packets. The previous implementation had different payload types for mono and stereo, which breaks the proposed standard. While working on this CL I ran in to the problem reported earlier, that we could get a crash related to deleting decoder memory. This should now be solved in Patch Set 3. BUG=issue1013, issue1112 Review URL: https://webrtc-codereview.appspot.com/933022 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3177 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -147,6 +147,9 @@ void TestAllCodecs::Perform() {
|
||||
CodecInst my_codec_param;
|
||||
for (uint8_t n = 0; n < num_encoders; n++) {
|
||||
acm_b_->Codec(n, my_codec_param);
|
||||
if (!strcmp(my_codec_param.plname, "opus")) {
|
||||
my_codec_param.channels = 1;
|
||||
}
|
||||
acm_b_->RegisterReceiveCodec(my_codec_param);
|
||||
}
|
||||
|
||||
@ -635,6 +638,7 @@ void TestAllCodecs::Perform() {
|
||||
Run(channel_a_to_b_);
|
||||
RegisterSendCodec('A', codec_opus, 48000, 500000, 960, -1);
|
||||
Run(channel_a_to_b_);
|
||||
outfile_b_.Close();
|
||||
#endif
|
||||
if (test_mode_ != 0) {
|
||||
printf("===============================================================\n");
|
||||
|
||||
@ -550,12 +550,18 @@ void TestStereo::Perform() {
|
||||
printf("Test number: %d\n",test_cntr_ + 1);
|
||||
printf("Test type: Mono-to-stereo\n");
|
||||
}
|
||||
|
||||
// Keep encode and decode in stereo.
|
||||
test_cntr_++;
|
||||
channel_a2b_->set_codec_mode(kStereo);
|
||||
OpenOutFile(test_cntr_);
|
||||
RegisterSendCodec('A', codec_opus, 48000, 64000, 960, codec_channels,
|
||||
opus_pltype_);
|
||||
Run(channel_a2b_, audio_channels, codec_channels);
|
||||
|
||||
// Encode in mono, decode in stereo mode.
|
||||
RegisterSendCodec('A', codec_opus, 48000, 64000, 960, 1, opus_pltype_);
|
||||
Run(channel_a2b_, audio_channels, codec_channels);
|
||||
out_file_.Close();
|
||||
#endif
|
||||
|
||||
@ -661,10 +667,63 @@ void TestStereo::Perform() {
|
||||
}
|
||||
test_cntr_++;
|
||||
OpenOutFile(test_cntr_);
|
||||
// Encode and decode in mono.
|
||||
RegisterSendCodec('A', codec_opus, 48000, 32000, 960, codec_channels,
|
||||
opus_pltype_);
|
||||
CodecInst opus_codec_param;
|
||||
for (WebRtc_UWord8 n = 0; n < num_encoders; n++) {
|
||||
EXPECT_EQ(0, acm_b_->Codec(n, opus_codec_param));
|
||||
if (!strcmp(opus_codec_param.plname, "opus")) {
|
||||
opus_codec_param.channels = 1;
|
||||
EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(opus_codec_param));
|
||||
break;
|
||||
}
|
||||
}
|
||||
Run(channel_a2b_, audio_channels, codec_channels);
|
||||
|
||||
// Encode in stereo, decode in mono.
|
||||
RegisterSendCodec('A', codec_opus, 48000, 32000, 960, 2, opus_pltype_);
|
||||
Run(channel_a2b_, audio_channels, codec_channels);
|
||||
|
||||
out_file_.Close();
|
||||
|
||||
// Test switching between decoding mono and stereo for Opus.
|
||||
|
||||
// Decode in mono.
|
||||
test_cntr_++;
|
||||
OpenOutFile(test_cntr_);
|
||||
if (test_mode_ != 0) {
|
||||
// Print out codec and settings
|
||||
printf("Test number: %d\nCodec: Opus Freq: 48000 Rate :32000 PackSize: 960"
|
||||
" Decode: mono\n", test_cntr_);
|
||||
}
|
||||
Run(channel_a2b_, audio_channels, codec_channels);
|
||||
out_file_.Close();
|
||||
// Decode in stereo.
|
||||
test_cntr_++;
|
||||
OpenOutFile(test_cntr_);
|
||||
if (test_mode_ != 0) {
|
||||
// Print out codec and settings
|
||||
printf("Test number: %d\nCodec: Opus Freq: 48000 Rate :32000 PackSize: 960"
|
||||
" Decode: stereo\n", test_cntr_);
|
||||
}
|
||||
opus_codec_param.channels = 2;
|
||||
EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(opus_codec_param));
|
||||
Run(channel_a2b_, audio_channels, 2);
|
||||
out_file_.Close();
|
||||
// Decode in mono.
|
||||
test_cntr_++;
|
||||
OpenOutFile(test_cntr_);
|
||||
if (test_mode_ != 0) {
|
||||
// Print out codec and settings
|
||||
printf("Test number: %d\nCodec: Opus Freq: 48000 Rate :32000 PackSize: 960"
|
||||
" Decode: mono\n", test_cntr_);
|
||||
}
|
||||
opus_codec_param.channels = 1;
|
||||
EXPECT_EQ(0, acm_b_->RegisterReceiveCodec(opus_codec_param));
|
||||
Run(channel_a2b_, audio_channels, codec_channels);
|
||||
out_file_.Close();
|
||||
|
||||
#endif
|
||||
|
||||
// Print out which codecs were tested, and which were not, in the run.
|
||||
@ -679,6 +738,9 @@ void TestStereo::Perform() {
|
||||
printf(" G.711\n");
|
||||
#ifdef WEBRTC_CODEC_CELT
|
||||
printf(" CELT\n");
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_OPUS
|
||||
printf(" Opus\n");
|
||||
#endif
|
||||
printf("\nTo complete the test, listen to the %d number of output "
|
||||
"files.\n",
|
||||
|
||||
@ -83,6 +83,10 @@ void TestVADDTX::Perform()
|
||||
{
|
||||
printf("%s\n", myCodecParam.plname);
|
||||
}
|
||||
if (!strcmp(myCodecParam.plname, "opus")) {
|
||||
// Use mono decoding for Opus in the VAD/DTX test.
|
||||
myCodecParam.channels = 1;
|
||||
}
|
||||
_acmB->RegisterReceiveCodec(myCodecParam);
|
||||
}
|
||||
|
||||
@ -337,6 +341,8 @@ WebRtc_Word16 TestVADDTX::RegisterSendCodec(char side,
|
||||
}
|
||||
}
|
||||
|
||||
// We only allow VAD/DTX when sending mono.
|
||||
myCodecParam.channels = 1;
|
||||
CHECK_ERROR(myACM->RegisterSendCodec(myCodecParam));
|
||||
|
||||
// initialization was succesful
|
||||
|
||||
Reference in New Issue
Block a user