Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: webrtc/audio/audio_send_stream_unittest.cc

Issue 2772773002: Adding cbr support for Opus (Closed)
Patch Set: Merge opus dtx and cbr testing. Other review comments adressed as well Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 config.send_codec_spec.max_ptime_ms = 60; 278 config.send_codec_spec.max_ptime_ms = 60;
279 config.send_codec_spec.codec_inst = kIsacCodec; 279 config.send_codec_spec.codec_inst = kIsacCodec;
280 config.rtp.extensions.push_back( 280 config.rtp.extensions.push_back(
281 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId)); 281 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId));
282 EXPECT_EQ( 282 EXPECT_EQ(
283 "{rtp: {ssrc: 1234, extensions: [{uri: " 283 "{rtp: {ssrc: 1234, extensions: [{uri: "
284 "urn:ietf:params:rtp-hdrext:ssrc-audio-level, id: 2}], nack: " 284 "urn:ietf:params:rtp-hdrext:ssrc-audio-level, id: 2}], nack: "
285 "{rtp_history_ms: 0}, c_name: foo_name}, send_transport: null, " 285 "{rtp_history_ms: 0}, c_name: foo_name}, send_transport: null, "
286 "voe_channel_id: 1, min_bitrate_bps: 12000, max_bitrate_bps: 34000, " 286 "voe_channel_id: 1, min_bitrate_bps: 12000, max_bitrate_bps: 34000, "
287 "send_codec_spec: {nack_enabled: true, transport_cc_enabled: false, " 287 "send_codec_spec: {nack_enabled: true, transport_cc_enabled: false, "
288 "enable_codec_fec: true, enable_opus_dtx: false, opus_max_playback_rate: " 288 "enable_codec_fec: true, enable_opus_dtx: false, enable_opus_cbr: false, "
289 "32000, cng_payload_type: 42, cng_plfreq: 56, min_ptime: 20, max_ptime: " 289 "opus_max_playback_rate: 32000, "
290 "cng_payload_type: 42, cng_plfreq: 56, min_ptime: 20, max_ptime: "
290 "60, codec_inst: {pltype: 103, plname: \"isac\", plfreq: 16000, pacsize: " 291 "60, codec_inst: {pltype: 103, plname: \"isac\", plfreq: 16000, pacsize: "
291 "320, channels: 1, rate: 32000}}}", 292 "320, channels: 1, rate: 32000}}}",
292 config.ToString()); 293 config.ToString());
293 } 294 }
294 295
295 TEST(AudioSendStreamTest, ConstructDestruct) { 296 TEST(AudioSendStreamTest, ConstructDestruct) {
296 ConfigHelper helper(false); 297 ConfigHelper helper(false);
297 internal::AudioSendStream send_stream( 298 internal::AudioSendStream send_stream(
298 helper.config(), helper.audio_state(), helper.worker_queue(), 299 helper.config(), helper.audio_state(), helper.worker_queue(),
299 helper.packet_router(), helper.congestion_controller(), 300 helper.packet_router(), helper.congestion_controller(),
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); 389 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected);
389 } 390 }
390 391
391 TEST(AudioSendStreamTest, SendCodecAppliesConfigParams) { 392 TEST(AudioSendStreamTest, SendCodecAppliesConfigParams) {
392 ConfigHelper helper(false); 393 ConfigHelper helper(false);
393 auto stream_config = helper.config(); 394 auto stream_config = helper.config();
394 const CodecInst kOpusCodec = {111, "opus", 48000, 960, 2, 64000}; 395 const CodecInst kOpusCodec = {111, "opus", 48000, 960, 2, 64000};
395 stream_config.send_codec_spec.codec_inst = kOpusCodec; 396 stream_config.send_codec_spec.codec_inst = kOpusCodec;
396 stream_config.send_codec_spec.enable_codec_fec = true; 397 stream_config.send_codec_spec.enable_codec_fec = true;
397 stream_config.send_codec_spec.enable_opus_dtx = true; 398 stream_config.send_codec_spec.enable_opus_dtx = true;
399 stream_config.send_codec_spec.enable_opus_cbr = true;
398 stream_config.send_codec_spec.opus_max_playback_rate = 12345; 400 stream_config.send_codec_spec.opus_max_playback_rate = 12345;
399 stream_config.send_codec_spec.cng_plfreq = 16000; 401 stream_config.send_codec_spec.cng_plfreq = 16000;
400 stream_config.send_codec_spec.cng_payload_type = 105; 402 stream_config.send_codec_spec.cng_payload_type = 105;
401 stream_config.send_codec_spec.min_ptime_ms = 10; 403 stream_config.send_codec_spec.min_ptime_ms = 10;
402 stream_config.send_codec_spec.max_ptime_ms = 60; 404 stream_config.send_codec_spec.max_ptime_ms = 60;
403 stream_config.audio_network_adaptor_config = 405 stream_config.audio_network_adaptor_config =
404 rtc::Optional<std::string>("abced"); 406 rtc::Optional<std::string>("abced");
405 EXPECT_CALL(*helper.channel_proxy(), SetCodecFECStatus(true)) 407 EXPECT_CALL(*helper.channel_proxy(), SetCodecFECStatus(true))
406 .WillOnce(Return(true)); 408 .WillOnce(Return(true));
407 EXPECT_CALL( 409 EXPECT_CALL(
408 *helper.channel_proxy(), 410 *helper.channel_proxy(),
409 SetOpusDtx(stream_config.send_codec_spec.enable_opus_dtx)) 411 SetOpusDtx(stream_config.send_codec_spec.enable_opus_dtx))
410 .WillOnce(Return(true)); 412 .WillOnce(Return(true));
411 EXPECT_CALL( 413 EXPECT_CALL(*helper.channel_proxy(),
412 *helper.channel_proxy(), 414 SetOpusCbr(stream_config.send_codec_spec.enable_opus_cbr))
413 SetOpusMaxPlaybackRate( 415 .WillOnce(Return(true));
414 stream_config.send_codec_spec.opus_max_playback_rate)) 416 EXPECT_CALL(*helper.channel_proxy(),
417 SetOpusMaxPlaybackRate(
418 stream_config.send_codec_spec.opus_max_playback_rate))
415 .WillOnce(Return(true)); 419 .WillOnce(Return(true));
416 EXPECT_CALL(*helper.channel_proxy(), 420 EXPECT_CALL(*helper.channel_proxy(),
417 SetSendCNPayloadType( 421 SetSendCNPayloadType(
418 stream_config.send_codec_spec.cng_payload_type, 422 stream_config.send_codec_spec.cng_payload_type,
419 webrtc::kFreq16000Hz)) 423 webrtc::kFreq16000Hz))
420 .WillOnce(Return(true)); 424 .WillOnce(Return(true));
421 EXPECT_CALL( 425 EXPECT_CALL(
422 *helper.channel_proxy(), 426 *helper.channel_proxy(),
423 SetReceiverFrameLengthRange(stream_config.send_codec_spec.min_ptime_ms, 427 SetReceiverFrameLengthRange(stream_config.send_codec_spec.min_ptime_ms,
424 stream_config.send_codec_spec.max_ptime_ms)); 428 stream_config.send_codec_spec.max_ptime_ms));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 internal::AudioSendStream send_stream( 469 internal::AudioSendStream send_stream(
466 helper.config(), helper.audio_state(), helper.worker_queue(), 470 helper.config(), helper.audio_state(), helper.worker_queue(),
467 helper.packet_router(), helper.congestion_controller(), 471 helper.packet_router(), helper.congestion_controller(),
468 helper.bitrate_allocator(), helper.event_log(), helper.rtcp_rtt_stats()); 472 helper.bitrate_allocator(), helper.event_log(), helper.rtcp_rtt_stats());
469 EXPECT_CALL(*helper.channel_proxy(), SetBitrate(_, 5000)); 473 EXPECT_CALL(*helper.channel_proxy(), SetBitrate(_, 5000));
470 send_stream.OnBitrateUpdated(50000, 0.0, 50, 5000); 474 send_stream.OnBitrateUpdated(50000, 0.0, 50, 5000);
471 } 475 }
472 476
473 } // namespace test 477 } // namespace test
474 } // namespace webrtc 478 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698