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 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3155 stream.ssrcs.push_back(kSsrc2); | 3155 stream.ssrcs.push_back(kSsrc2); |
3156 EXPECT_TRUE(channel_->AddRecvStream(stream)); | 3156 EXPECT_TRUE(channel_->AddRecvStream(stream)); |
3157 cricket::WebRtcVoiceMediaChannel* media_channel = | 3157 cricket::WebRtcVoiceMediaChannel* media_channel = |
3158 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); | 3158 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); |
3159 EXPECT_LT(media_channel->voe_channel(), | 3159 EXPECT_LT(media_channel->voe_channel(), |
3160 media_channel->GetReceiveChannelNum(kSsrc2)); | 3160 media_channel->GetReceiveChannelNum(kSsrc2)); |
3161 } | 3161 } |
3162 | 3162 |
3163 TEST_F(WebRtcVoiceEngineTestFake, SetOutputScaling) { | 3163 TEST_F(WebRtcVoiceEngineTestFake, SetOutputScaling) { |
3164 EXPECT_TRUE(SetupEngine()); | 3164 EXPECT_TRUE(SetupEngine()); |
3165 double left, right; | 3165 float scale, left, right; |
3166 EXPECT_TRUE(channel_->SetOutputScaling(0, 1, 2)); | 3166 EXPECT_TRUE(channel_->SetOutputScaling(0, 1, 2)); |
3167 EXPECT_TRUE(channel_->GetOutputScaling(0, &left, &right)); | 3167 int channel_id = voe_.GetLastChannel(); |
3168 EXPECT_DOUBLE_EQ(1, left); | 3168 EXPECT_EQ(0, voe_.GetChannelOutputVolumeScaling(channel_id, scale)); |
3169 EXPECT_DOUBLE_EQ(2, right); | 3169 EXPECT_EQ(0, voe_.GetOutputVolumePan(channel_id, left, right)); |
| 3170 EXPECT_DOUBLE_EQ(1, left * scale); |
| 3171 EXPECT_DOUBLE_EQ(2, right * scale); |
3170 | 3172 |
3171 EXPECT_FALSE(channel_->SetOutputScaling(kSsrc2, 1, 2)); | 3173 EXPECT_FALSE(channel_->SetOutputScaling(kSsrc2, 1, 2)); |
3172 cricket::StreamParams stream; | 3174 cricket::StreamParams stream; |
3173 stream.ssrcs.push_back(kSsrc2); | 3175 stream.ssrcs.push_back(kSsrc2); |
3174 EXPECT_TRUE(channel_->AddRecvStream(stream)); | 3176 EXPECT_TRUE(channel_->AddRecvStream(stream)); |
3175 | 3177 |
3176 EXPECT_TRUE(channel_->SetOutputScaling(kSsrc2, 2, 1)); | 3178 EXPECT_TRUE(channel_->SetOutputScaling(kSsrc2, 2, 1)); |
3177 EXPECT_TRUE(channel_->GetOutputScaling(kSsrc2, &left, &right)); | 3179 channel_id = voe_.GetLastChannel(); |
3178 EXPECT_DOUBLE_EQ(2, left); | 3180 EXPECT_EQ(0, voe_.GetChannelOutputVolumeScaling(channel_id, scale)); |
3179 EXPECT_DOUBLE_EQ(1, right); | 3181 EXPECT_EQ(0, voe_.GetOutputVolumePan(channel_id, left, right)); |
| 3182 EXPECT_DOUBLE_EQ(2, left * scale); |
| 3183 EXPECT_DOUBLE_EQ(1, right * scale); |
3180 } | 3184 } |
3181 | 3185 |
3182 TEST_F(WebRtcVoiceEngineTestFake, SetsSyncGroupFromSyncLabel) { | 3186 TEST_F(WebRtcVoiceEngineTestFake, SetsSyncGroupFromSyncLabel) { |
3183 cricket::FakeCall call((webrtc::Call::Config())); | 3187 cricket::FakeCall call((webrtc::Call::Config())); |
3184 const uint32 kAudioSsrc = 123; | 3188 const uint32 kAudioSsrc = 123; |
3185 const std::string kSyncLabel = "AvSyncLabel"; | 3189 const std::string kSyncLabel = "AvSyncLabel"; |
3186 | 3190 |
3187 EXPECT_TRUE(SetupEngine()); | 3191 EXPECT_TRUE(SetupEngine()); |
3188 cricket::WebRtcVoiceMediaChannel* media_channel = | 3192 cricket::WebRtcVoiceMediaChannel* media_channel = |
3189 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); | 3193 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3624 engine.Terminate(); | 3628 engine.Terminate(); |
3625 } | 3629 } |
3626 | 3630 |
3627 // Test that we set our preferred codecs properly. | 3631 // Test that we set our preferred codecs properly. |
3628 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { | 3632 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { |
3629 cricket::WebRtcVoiceEngine engine; | 3633 cricket::WebRtcVoiceEngine engine; |
3630 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); | 3634 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); |
3631 cricket::WebRtcVoiceMediaChannel channel(&engine); | 3635 cricket::WebRtcVoiceMediaChannel channel(&engine); |
3632 EXPECT_TRUE(channel.SetRecvCodecs(engine.codecs())); | 3636 EXPECT_TRUE(channel.SetRecvCodecs(engine.codecs())); |
3633 } | 3637 } |
OLD | NEW |