| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2008 Google Inc. | 3 * Copyright 2008 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // If this is a caller, local description will be applied and add the | 141 // If this is a caller, local description will be applied and add the |
| 142 // send stream. | 142 // send stream. |
| 143 EXPECT_TRUE(channel_->AddSendStream( | 143 EXPECT_TRUE(channel_->AddSendStream( |
| 144 cricket::StreamParams::CreateLegacy(kSsrc1))); | 144 cricket::StreamParams::CreateLegacy(kSsrc1))); |
| 145 } | 145 } |
| 146 | 146 |
| 147 // Test we can only InsertDtmf when the other side supports telephone-event. | 147 // Test we can only InsertDtmf when the other side supports telephone-event. |
| 148 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 148 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 149 EXPECT_TRUE(channel_->SetSend(cricket::SEND_MICROPHONE)); | 149 EXPECT_TRUE(channel_->SetSend(cricket::SEND_MICROPHONE)); |
| 150 EXPECT_FALSE(channel_->CanInsertDtmf()); | 150 EXPECT_FALSE(channel_->CanInsertDtmf()); |
| 151 EXPECT_FALSE(channel_->InsertDtmf(ssrc, 1, 111, cricket::DF_SEND)); | 151 EXPECT_FALSE(channel_->InsertDtmf(ssrc, 1, 111)); |
| 152 send_parameters_.codecs.push_back(kTelephoneEventCodec); | 152 send_parameters_.codecs.push_back(kTelephoneEventCodec); |
| 153 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 153 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 154 EXPECT_TRUE(channel_->CanInsertDtmf()); | 154 EXPECT_TRUE(channel_->CanInsertDtmf()); |
| 155 | 155 |
| 156 if (!caller) { | 156 if (!caller) { |
| 157 // If this is callee, there's no active send channel yet. | 157 // If this is callee, there's no active send channel yet. |
| 158 EXPECT_FALSE(channel_->InsertDtmf(ssrc, 2, 123, cricket::DF_SEND)); | 158 EXPECT_FALSE(channel_->InsertDtmf(ssrc, 2, 123)); |
| 159 EXPECT_TRUE(channel_->AddSendStream( | 159 EXPECT_TRUE(channel_->AddSendStream( |
| 160 cricket::StreamParams::CreateLegacy(kSsrc1))); | 160 cricket::StreamParams::CreateLegacy(kSsrc1))); |
| 161 } | 161 } |
| 162 | 162 |
| 163 // Check we fail if the ssrc is invalid. | 163 // Check we fail if the ssrc is invalid. |
| 164 EXPECT_FALSE(channel_->InsertDtmf(-1, 1, 111, cricket::DF_SEND)); | 164 EXPECT_FALSE(channel_->InsertDtmf(-1, 1, 111)); |
| 165 | 165 |
| 166 // Test send | 166 // Test send |
| 167 int channel_id = voe_.GetLastChannel(); | 167 int channel_id = voe_.GetLastChannel(); |
| 168 EXPECT_FALSE(voe_.WasSendTelephoneEventCalled(channel_id, 2, 123)); | 168 EXPECT_FALSE(voe_.WasSendTelephoneEventCalled(channel_id, 2, 123)); |
| 169 EXPECT_TRUE(channel_->InsertDtmf(ssrc, 2, 123, cricket::DF_SEND)); | 169 EXPECT_TRUE(channel_->InsertDtmf(ssrc, 2, 123)); |
| 170 EXPECT_TRUE(voe_.WasSendTelephoneEventCalled(channel_id, 2, 123)); | 170 EXPECT_TRUE(voe_.WasSendTelephoneEventCalled(channel_id, 2, 123)); |
| 171 | |
| 172 // Test play | |
| 173 EXPECT_FALSE(voe_.WasPlayDtmfToneCalled(3, 134)); | |
| 174 EXPECT_TRUE(channel_->InsertDtmf(ssrc, 3, 134, cricket::DF_PLAY)); | |
| 175 EXPECT_TRUE(voe_.WasPlayDtmfToneCalled(3, 134)); | |
| 176 | |
| 177 // Test send and play | |
| 178 EXPECT_FALSE(voe_.WasSendTelephoneEventCalled(channel_id, 4, 145)); | |
| 179 EXPECT_FALSE(voe_.WasPlayDtmfToneCalled(4, 145)); | |
| 180 EXPECT_TRUE(channel_->InsertDtmf(ssrc, 4, 145, | |
| 181 cricket::DF_PLAY | cricket::DF_SEND)); | |
| 182 EXPECT_TRUE(voe_.WasSendTelephoneEventCalled(channel_id, 4, 145)); | |
| 183 EXPECT_TRUE(voe_.WasPlayDtmfToneCalled(4, 145)); | |
| 184 } | 171 } |
| 185 | 172 |
| 186 // Test that send bandwidth is set correctly. | 173 // Test that send bandwidth is set correctly. |
| 187 // |codec| is the codec under test. | 174 // |codec| is the codec under test. |
| 188 // |max_bitrate| is a parameter to set to SetMaxSendBandwidth(). | 175 // |max_bitrate| is a parameter to set to SetMaxSendBandwidth(). |
| 189 // |expected_result| is the expected result from SetMaxSendBandwidth(). | 176 // |expected_result| is the expected result from SetMaxSendBandwidth(). |
| 190 // |expected_bitrate| is the expected audio bitrate afterward. | 177 // |expected_bitrate| is the expected audio bitrate afterward. |
| 191 void TestSendBandwidth(const cricket::AudioCodec& codec, | 178 void TestSendBandwidth(const cricket::AudioCodec& codec, |
| 192 int max_bitrate, | 179 int max_bitrate, |
| 193 bool expected_result, | 180 bool expected_result, |
| (...skipping 3162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3356 cricket::WebRtcVoiceEngine engine; | 3343 cricket::WebRtcVoiceEngine engine; |
| 3357 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); | 3344 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); |
| 3358 rtc::scoped_ptr<webrtc::Call> call( | 3345 rtc::scoped_ptr<webrtc::Call> call( |
| 3359 webrtc::Call::Create(webrtc::Call::Config())); | 3346 webrtc::Call::Create(webrtc::Call::Config())); |
| 3360 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), | 3347 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), |
| 3361 call.get()); | 3348 call.get()); |
| 3362 cricket::AudioRecvParameters parameters; | 3349 cricket::AudioRecvParameters parameters; |
| 3363 parameters.codecs = engine.codecs(); | 3350 parameters.codecs = engine.codecs(); |
| 3364 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3351 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
| 3365 } | 3352 } |
| OLD | NEW |