Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 |
| 11 #include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" | 11 #include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" |
| 12 #include "webrtc/voice_engine/voice_engine_defines.h" | 12 #include "webrtc/voice_engine/voice_engine_defines.h" |
| 13 | 13 |
| 14 class DtmfTest : public AfterStreamingFixture { | 14 class DtmfTest : public AfterStreamingFixture { |
| 15 protected: | 15 protected: |
| 16 void RunSixteenDtmfEvents(bool out_of_band) { | 16 void RunSixteenDtmfEvents() { |
| 17 TEST_LOG("Sending telephone events:\n"); | 17 TEST_LOG("Sending telephone events:\n"); |
| 18 EXPECT_EQ(0, voe_dtmf_->SetDtmfFeedbackStatus(false)); | |
| 19 | |
| 20 for (int i = 0; i < 16; i++) { | 18 for (int i = 0; i < 16; i++) { |
| 21 TEST_LOG("%d ", i); | 19 TEST_LOG("%d ", i); |
| 22 TEST_LOG_FLUSH; | 20 TEST_LOG_FLUSH; |
| 23 EXPECT_EQ(0, voe_dtmf_->SendTelephoneEvent( | 21 EXPECT_EQ(true, channel_proxy_->SendTelephoneEventOutband(i, 160)); |
|
hlundin-webrtc
2016/03/07 15:59:23
EXPECT_TRUE? Here and below.
the sun
2016/03/07 16:11:35
Done.
| |
| 24 channel_, i, out_of_band, 160, 10)); | |
| 25 Sleep(500); | 22 Sleep(500); |
| 26 } | 23 } |
| 27 TEST_LOG("\n"); | 24 TEST_LOG("\n"); |
| 28 } | 25 } |
| 29 }; | 26 }; |
| 30 | 27 |
| 31 TEST_F(DtmfTest, DtmfFeedbackIsEnabledByDefaultButNotDirectFeedback) { | |
| 32 bool dtmf_feedback = false; | |
| 33 bool dtmf_direct_feedback = false; | |
| 34 | |
| 35 EXPECT_EQ(0, voe_dtmf_->GetDtmfFeedbackStatus(dtmf_feedback, | |
| 36 dtmf_direct_feedback)); | |
| 37 | |
| 38 EXPECT_TRUE(dtmf_feedback); | |
| 39 EXPECT_FALSE(dtmf_direct_feedback); | |
| 40 } | |
| 41 | |
| 42 TEST_F(DtmfTest, ManualSuccessfullySendsInBandTelephoneEvents) { | |
| 43 RunSixteenDtmfEvents(false); | |
| 44 } | |
| 45 | |
| 46 TEST_F(DtmfTest, ManualSuccessfullySendsOutOfBandTelephoneEvents) { | 28 TEST_F(DtmfTest, ManualSuccessfullySendsOutOfBandTelephoneEvents) { |
| 47 RunSixteenDtmfEvents(true); | 29 RunSixteenDtmfEvents(); |
| 48 } | 30 } |
| 49 | 31 |
| 50 TEST_F(DtmfTest, TestTwoNonDtmfEvents) { | 32 TEST_F(DtmfTest, TestTwoNonDtmfEvents) { |
| 51 EXPECT_EQ(0, voe_dtmf_->SendTelephoneEvent(channel_, 32, true)); | 33 EXPECT_EQ(true, channel_proxy_->SendTelephoneEventOutband(32, 160)); |
| 52 EXPECT_EQ(0, voe_dtmf_->SendTelephoneEvent(channel_, 110, true)); | 34 EXPECT_EQ(true, channel_proxy_->SendTelephoneEventOutband(110, 160)); |
| 53 } | 35 } |
| 54 | 36 |
| 55 // This test modifies the DTMF payload type from the default 106 to 88 | 37 // This test modifies the DTMF payload type from the default 106 to 88 |
| 56 // and then runs through 16 DTMF out.of-band events. | 38 // and then runs through 16 DTMF out.of-band events. |
| 57 TEST_F(DtmfTest, ManualCanChangeDtmfPayloadType) { | 39 TEST_F(DtmfTest, ManualCanChangeDtmfPayloadType) { |
| 58 webrtc::CodecInst codec_instance = webrtc::CodecInst(); | 40 webrtc::CodecInst codec_instance = webrtc::CodecInst(); |
| 59 | 41 |
| 60 TEST_LOG("Changing DTMF payload type.\n"); | 42 TEST_LOG("Changing DTMF payload type.\n"); |
| 61 | 43 |
| 62 // Start by modifying the receiving side. | 44 // Start by modifying the receiving side. |
| 63 for (int i = 0; i < voe_codec_->NumOfCodecs(); i++) { | 45 for (int i = 0; i < voe_codec_->NumOfCodecs(); i++) { |
| 64 EXPECT_EQ(0, voe_codec_->GetCodec(i, codec_instance)); | 46 EXPECT_EQ(0, voe_codec_->GetCodec(i, codec_instance)); |
| 65 if (!_stricmp("telephone-event", codec_instance.plname)) { | 47 if (!_stricmp("telephone-event", codec_instance.plname)) { |
| 66 codec_instance.pltype = 88; // Use 88 instead of default 106. | 48 codec_instance.pltype = 88; // Use 88 instead of default 106. |
| 67 EXPECT_EQ(0, voe_base_->StopSend(channel_)); | 49 EXPECT_EQ(0, voe_base_->StopSend(channel_)); |
| 68 EXPECT_EQ(0, voe_base_->StopPlayout(channel_)); | 50 EXPECT_EQ(0, voe_base_->StopPlayout(channel_)); |
| 69 EXPECT_EQ(0, voe_base_->StopReceive(channel_)); | 51 EXPECT_EQ(0, voe_base_->StopReceive(channel_)); |
| 70 EXPECT_EQ(0, voe_codec_->SetRecPayloadType(channel_, codec_instance)); | 52 EXPECT_EQ(0, voe_codec_->SetRecPayloadType(channel_, codec_instance)); |
| 71 EXPECT_EQ(0, voe_base_->StartReceive(channel_)); | 53 EXPECT_EQ(0, voe_base_->StartReceive(channel_)); |
| 72 EXPECT_EQ(0, voe_base_->StartPlayout(channel_)); | 54 EXPECT_EQ(0, voe_base_->StartPlayout(channel_)); |
| 73 EXPECT_EQ(0, voe_base_->StartSend(channel_)); | 55 EXPECT_EQ(0, voe_base_->StartSend(channel_)); |
| 74 break; | 56 break; |
| 75 } | 57 } |
| 76 } | 58 } |
| 77 | 59 |
| 78 Sleep(500); | 60 Sleep(500); |
| 79 | 61 |
| 80 // Next, we must modify the sending side as well. | 62 // Next, we must modify the sending side as well. |
| 81 EXPECT_EQ(0, voe_dtmf_->SetSendTelephoneEventPayloadType( | 63 EXPECT_EQ(true, |
| 82 channel_, codec_instance.pltype)); | 64 channel_proxy_->SetSendTelephoneEventPayloadType(codec_instance.pltype)); |
| 83 | 65 |
| 84 RunSixteenDtmfEvents(true); | 66 RunSixteenDtmfEvents(); |
| 85 | |
| 86 EXPECT_EQ(0, voe_dtmf_->SetDtmfFeedbackStatus(true, false)); | |
| 87 } | 67 } |
| OLD | NEW |