| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #include "voice_engine/test/auto_test/fixtures/after_streaming_fixture.h" | |
| 12 #include "voice_engine/voice_engine_defines.h" | |
| 13 | |
| 14 class DtmfTest : public AfterStreamingFixture { | |
| 15 protected: | |
| 16 void RunSixteenDtmfEvents() { | |
| 17 TEST_LOG("Sending telephone events:\n"); | |
| 18 for (int i = 0; i < 16; i++) { | |
| 19 TEST_LOG("%d ", i); | |
| 20 TEST_LOG_FLUSH; | |
| 21 EXPECT_TRUE(channel_proxy_->SendTelephoneEventOutband(i, 160)); | |
| 22 Sleep(500); | |
| 23 } | |
| 24 TEST_LOG("\n"); | |
| 25 } | |
| 26 }; | |
| 27 | |
| 28 TEST_F(DtmfTest, ManualSuccessfullySendsOutOfBandTelephoneEvents) { | |
| 29 RunSixteenDtmfEvents(); | |
| 30 } | |
| 31 | |
| 32 TEST_F(DtmfTest, TestTwoNonDtmfEvents) { | |
| 33 EXPECT_TRUE(channel_proxy_->SendTelephoneEventOutband(32, 160)); | |
| 34 EXPECT_TRUE(channel_proxy_->SendTelephoneEventOutband(110, 160)); | |
| 35 } | |
| 36 | |
| 37 // This test modifies the DTMF payload type from the default 106 to 88 | |
| 38 // and then runs through 16 DTMF out.of-band events. | |
| 39 TEST_F(DtmfTest, ManualCanChangeDtmfPayloadType) { | |
| 40 webrtc::CodecInst codec_instance = webrtc::CodecInst(); | |
| 41 | |
| 42 TEST_LOG("Changing DTMF payload type.\n"); | |
| 43 | |
| 44 // Start by modifying the receiving side. | |
| 45 for (int i = 0; i < voe_codec_->NumOfCodecs(); i++) { | |
| 46 EXPECT_EQ(0, voe_codec_->GetCodec(i, codec_instance)); | |
| 47 if (!STR_CASE_CMP("telephone-event", codec_instance.plname)) { | |
| 48 codec_instance.pltype = 88; // Use 88 instead of default 106. | |
| 49 EXPECT_EQ(0, voe_base_->StopSend(channel_)); | |
| 50 EXPECT_EQ(0, voe_base_->StopPlayout(channel_)); | |
| 51 EXPECT_EQ(0, voe_codec_->SetRecPayloadType(channel_, codec_instance)); | |
| 52 EXPECT_EQ(0, voe_base_->StartPlayout(channel_)); | |
| 53 EXPECT_EQ(0, voe_base_->StartSend(channel_)); | |
| 54 break; | |
| 55 } | |
| 56 } | |
| 57 | |
| 58 Sleep(500); | |
| 59 | |
| 60 // Next, we must modify the sending side as well. | |
| 61 EXPECT_TRUE( | |
| 62 channel_proxy_->SetSendTelephoneEventPayloadType(codec_instance.pltype, | |
| 63 codec_instance.plfreq)); | |
| 64 | |
| 65 RunSixteenDtmfEvents(); | |
| 66 } | |
| OLD | NEW |