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

Side by Side Diff: talk/session/media/channel_unittest.cc

Issue 1397773002: Change SetOutputScaling to set a single level, not left/right levels. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase+rename Created 5 years, 2 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
« no previous file with comments | « talk/session/media/channel.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2009 Google Inc. 3 * Copyright 2009 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 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 2182
2183 TEST_F(VoiceChannelTest, TestOnReadyToSendWithRtcpMux) { 2183 TEST_F(VoiceChannelTest, TestOnReadyToSendWithRtcpMux) {
2184 Base::TestOnReadyToSendWithRtcpMux(); 2184 Base::TestOnReadyToSendWithRtcpMux();
2185 } 2185 }
2186 2186
2187 // Test that we can scale the output volume properly for 1:1 calls. 2187 // Test that we can scale the output volume properly for 1:1 calls.
2188 TEST_F(VoiceChannelTest, TestScaleVolume1to1Call) { 2188 TEST_F(VoiceChannelTest, TestScaleVolume1to1Call) {
2189 CreateChannels(RTCP, RTCP); 2189 CreateChannels(RTCP, RTCP);
2190 EXPECT_TRUE(SendInitiate()); 2190 EXPECT_TRUE(SendInitiate());
2191 EXPECT_TRUE(SendAccept()); 2191 EXPECT_TRUE(SendAccept());
2192 double left, right; 2192 double volume;
2193 2193
2194 // Default is (1.0, 1.0). 2194 // Default is (1.0).
2195 EXPECT_TRUE(media_channel1_->GetOutputScaling(0, &left, &right)); 2195 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2196 EXPECT_DOUBLE_EQ(1.0, left); 2196 EXPECT_DOUBLE_EQ(1.0, volume);
2197 EXPECT_DOUBLE_EQ(1.0, right);
2198 // invalid ssrc. 2197 // invalid ssrc.
2199 EXPECT_FALSE(media_channel1_->GetOutputScaling(3, &left, &right)); 2198 EXPECT_FALSE(media_channel1_->GetOutputVolume(3, &volume));
2200 2199
2201 // Set scale to (1.5, 0.5). 2200 // Set scale to (1.5).
2202 EXPECT_TRUE(channel1_->SetOutputScaling(0, 1.5, 0.5)); 2201 EXPECT_TRUE(channel1_->SetOutputVolume(0, 1.5));
2203 EXPECT_TRUE(media_channel1_->GetOutputScaling(0, &left, &right)); 2202 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2204 EXPECT_DOUBLE_EQ(1.5, left); 2203 EXPECT_DOUBLE_EQ(1.5, volume);
2205 EXPECT_DOUBLE_EQ(0.5, right);
2206 2204
2207 // Set scale to (0, 0). 2205 // Set scale to (0).
2208 EXPECT_TRUE(channel1_->SetOutputScaling(0, 0.0, 0.0)); 2206 EXPECT_TRUE(channel1_->SetOutputVolume(0, 0.0));
2209 EXPECT_TRUE(media_channel1_->GetOutputScaling(0, &left, &right)); 2207 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2210 EXPECT_DOUBLE_EQ(0.0, left); 2208 EXPECT_DOUBLE_EQ(0.0, volume);
2211 EXPECT_DOUBLE_EQ(0.0, right);
2212 } 2209 }
2213 2210
2214 // Test that we can scale the output volume properly for multiway calls. 2211 // Test that we can scale the output volume properly for multiway calls.
2215 TEST_F(VoiceChannelTest, TestScaleVolumeMultiwayCall) { 2212 TEST_F(VoiceChannelTest, TestScaleVolumeMultiwayCall) {
2216 CreateChannels(RTCP, RTCP); 2213 CreateChannels(RTCP, RTCP);
2217 EXPECT_TRUE(SendInitiate()); 2214 EXPECT_TRUE(SendInitiate());
2218 EXPECT_TRUE(SendAccept()); 2215 EXPECT_TRUE(SendAccept());
2219 EXPECT_TRUE(AddStream1(1)); 2216 EXPECT_TRUE(AddStream1(1));
2220 EXPECT_TRUE(AddStream1(2)); 2217 EXPECT_TRUE(AddStream1(2));
2221 2218
2222 double left, right; 2219 double volume;
2223 // Default is (1.0, 1.0). 2220 // Default is (1.0).
2224 EXPECT_TRUE(media_channel1_->GetOutputScaling(0, &left, &right)); 2221 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2225 EXPECT_DOUBLE_EQ(1.0, left); 2222 EXPECT_DOUBLE_EQ(1.0, volume);
2226 EXPECT_DOUBLE_EQ(1.0, right); 2223 EXPECT_TRUE(media_channel1_->GetOutputVolume(1, &volume));
2227 EXPECT_TRUE(media_channel1_->GetOutputScaling(1, &left, &right)); 2224 EXPECT_DOUBLE_EQ(1.0, volume);
2228 EXPECT_DOUBLE_EQ(1.0, left); 2225 EXPECT_TRUE(media_channel1_->GetOutputVolume(2, &volume));
2229 EXPECT_DOUBLE_EQ(1.0, right); 2226 EXPECT_DOUBLE_EQ(1.0, volume);
2230 EXPECT_TRUE(media_channel1_->GetOutputScaling(2, &left, &right));
2231 EXPECT_DOUBLE_EQ(1.0, left);
2232 EXPECT_DOUBLE_EQ(1.0, right);
2233 // invalid ssrc. 2227 // invalid ssrc.
2234 EXPECT_FALSE(media_channel1_->GetOutputScaling(3, &left, &right)); 2228 EXPECT_FALSE(media_channel1_->GetOutputVolume(3, &volume));
2235 2229
2236 // Set scale to (1.5, 0.5) for ssrc = 1. 2230 // Set scale to (1.5) for ssrc = 1.
2237 EXPECT_TRUE(channel1_->SetOutputScaling(1, 1.5, 0.5)); 2231 EXPECT_TRUE(channel1_->SetOutputVolume(1, 1.5));
2238 EXPECT_TRUE(media_channel1_->GetOutputScaling(1, &left, &right)); 2232 EXPECT_TRUE(media_channel1_->GetOutputVolume(1, &volume));
2239 EXPECT_DOUBLE_EQ(1.5, left); 2233 EXPECT_DOUBLE_EQ(1.5, volume);
2240 EXPECT_DOUBLE_EQ(0.5, right); 2234 EXPECT_TRUE(media_channel1_->GetOutputVolume(2, &volume));
2241 EXPECT_TRUE(media_channel1_->GetOutputScaling(2, &left, &right)); 2235 EXPECT_DOUBLE_EQ(1.0, volume);
2242 EXPECT_DOUBLE_EQ(1.0, left); 2236 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2243 EXPECT_DOUBLE_EQ(1.0, right); 2237 EXPECT_DOUBLE_EQ(1.0, volume);
2244 EXPECT_TRUE(media_channel1_->GetOutputScaling(0, &left, &right));
2245 EXPECT_DOUBLE_EQ(1.0, left);
2246 EXPECT_DOUBLE_EQ(1.0, right);
2247 2238
2248 // Set scale to (0, 0) for all ssrcs. 2239 // Set scale to (0) for all ssrcs.
2249 EXPECT_TRUE(channel1_->SetOutputScaling(0, 0.0, 0.0)); 2240 EXPECT_TRUE(channel1_->SetOutputVolume(0, 0.0));
2250 EXPECT_TRUE(media_channel1_->GetOutputScaling(0, &left, &right)); 2241 EXPECT_TRUE(media_channel1_->GetOutputVolume(0, &volume));
2251 EXPECT_DOUBLE_EQ(0.0, left); 2242 EXPECT_DOUBLE_EQ(0.0, volume);
2252 EXPECT_DOUBLE_EQ(0.0, right); 2243 EXPECT_TRUE(media_channel1_->GetOutputVolume(1, &volume));
2253 EXPECT_TRUE(media_channel1_->GetOutputScaling(1, &left, &right)); 2244 EXPECT_DOUBLE_EQ(0.0, volume);
2254 EXPECT_DOUBLE_EQ(0.0, left); 2245 EXPECT_TRUE(media_channel1_->GetOutputVolume(2, &volume));
2255 EXPECT_DOUBLE_EQ(0.0, right); 2246 EXPECT_DOUBLE_EQ(0.0, volume);
2256 EXPECT_TRUE(media_channel1_->GetOutputScaling(2, &left, &right));
2257 EXPECT_DOUBLE_EQ(0.0, left);
2258 EXPECT_DOUBLE_EQ(0.0, right);
2259 } 2247 }
2260 2248
2261 TEST_F(VoiceChannelTest, SendBundleToBundle) { 2249 TEST_F(VoiceChannelTest, SendBundleToBundle) {
2262 Base::SendBundleToBundle(kAudioPts, ARRAY_SIZE(kAudioPts), false, false); 2250 Base::SendBundleToBundle(kAudioPts, ARRAY_SIZE(kAudioPts), false, false);
2263 } 2251 }
2264 2252
2265 TEST_F(VoiceChannelTest, SendBundleToBundleSecure) { 2253 TEST_F(VoiceChannelTest, SendBundleToBundleSecure) {
2266 Base::SendBundleToBundle(kAudioPts, ARRAY_SIZE(kAudioPts), false, true); 2254 Base::SendBundleToBundle(kAudioPts, ARRAY_SIZE(kAudioPts), false, true);
2267 } 2255 }
2268 2256
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
2802 }; 2790 };
2803 rtc::Buffer payload(data, 3); 2791 rtc::Buffer payload(data, 3);
2804 cricket::SendDataResult result; 2792 cricket::SendDataResult result;
2805 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); 2793 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result));
2806 EXPECT_EQ(params.ssrc, 2794 EXPECT_EQ(params.ssrc,
2807 media_channel1_->last_sent_data_params().ssrc); 2795 media_channel1_->last_sent_data_params().ssrc);
2808 EXPECT_EQ("foo", media_channel1_->last_sent_data()); 2796 EXPECT_EQ("foo", media_channel1_->last_sent_data());
2809 } 2797 }
2810 2798
2811 // TODO(pthatcher): TestSetReceiver? 2799 // TODO(pthatcher): TestSetReceiver?
OLDNEW
« no previous file with comments | « talk/session/media/channel.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698