| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // Unmute the camera and expect non-black output frame. | 189 // Unmute the camera and expect non-black output frame. |
| 190 capturer_.MuteToBlackThenPause(false); | 190 capturer_.MuteToBlackThenPause(false); |
| 191 EXPECT_FALSE(capturer_.IsMuted()); | 191 EXPECT_FALSE(capturer_.IsMuted()); |
| 192 EXPECT_EQ_WAIT(cricket::CS_RUNNING, | 192 EXPECT_EQ_WAIT(cricket::CS_RUNNING, |
| 193 capturer_.capture_state(), kTimeout); | 193 capturer_.capture_state(), kTimeout); |
| 194 EXPECT_TRUE(capturer_.CaptureFrame()); | 194 EXPECT_TRUE(capturer_.CaptureFrame()); |
| 195 EXPECT_FALSE(renderer_.black_frame()); | 195 EXPECT_FALSE(renderer_.black_frame()); |
| 196 EXPECT_EQ(33, video_frames_received()); | 196 EXPECT_EQ(33, video_frames_received()); |
| 197 } | 197 } |
| 198 | 198 |
| 199 TEST_F(VideoCapturerTest, ScreencastScaledMaxPixels) { | |
| 200 capturer_.SetScreencast(true); | |
| 201 | |
| 202 int kWidth = 1280; | |
| 203 int kHeight = 720; | |
| 204 | |
| 205 // Screencasts usually have large weird dimensions and are ARGB. | |
| 206 std::vector<cricket::VideoFormat> formats; | |
| 207 formats.push_back(cricket::VideoFormat(kWidth, kHeight, | |
| 208 cricket::VideoFormat::FpsToInterval(5), cricket::FOURCC_ARGB)); | |
| 209 formats.push_back(cricket::VideoFormat(2 * kWidth, 2 * kHeight, | |
| 210 cricket::VideoFormat::FpsToInterval(5), cricket::FOURCC_ARGB)); | |
| 211 capturer_.ResetSupportedFormats(formats); | |
| 212 | |
| 213 | |
| 214 EXPECT_EQ(0, capturer_.screencast_max_pixels()); | |
| 215 EXPECT_EQ(cricket::CS_RUNNING, capturer_.Start(cricket::VideoFormat( | |
| 216 2 * kWidth, | |
| 217 2 * kHeight, | |
| 218 cricket::VideoFormat::FpsToInterval(30), | |
| 219 cricket::FOURCC_ARGB))); | |
| 220 EXPECT_TRUE(capturer_.IsRunning()); | |
| 221 EXPECT_EQ(0, renderer_.num_rendered_frames()); | |
| 222 renderer_.SetSize(2 * kWidth, 2 * kHeight, 0); | |
| 223 EXPECT_TRUE(capturer_.CaptureFrame()); | |
| 224 EXPECT_EQ(1, renderer_.num_rendered_frames()); | |
| 225 | |
| 226 capturer_.set_screencast_max_pixels(kWidth * kHeight); | |
| 227 renderer_.SetSize(kWidth, kHeight, 0); | |
| 228 EXPECT_TRUE(capturer_.CaptureFrame()); | |
| 229 EXPECT_EQ(2, renderer_.num_rendered_frames()); | |
| 230 } | |
| 231 | |
| 232 TEST_F(VideoCapturerTest, ScreencastScaledOddWidth) { | 199 TEST_F(VideoCapturerTest, ScreencastScaledOddWidth) { |
| 233 capturer_.SetScreencast(true); | 200 capturer_.SetScreencast(true); |
| 234 | 201 |
| 235 int kWidth = 1281; | 202 int kWidth = 1281; |
| 236 int kHeight = 720; | 203 int kHeight = 720; |
| 237 | 204 |
| 238 std::vector<cricket::VideoFormat> formats; | 205 std::vector<cricket::VideoFormat> formats; |
| 239 formats.push_back(cricket::VideoFormat(kWidth, kHeight, | 206 formats.push_back(cricket::VideoFormat(kWidth, kHeight, |
| 240 cricket::VideoFormat::FpsToInterval(5), cricket::FOURCC_ARGB)); | 207 cricket::VideoFormat::FpsToInterval(5), cricket::FOURCC_ARGB)); |
| 241 capturer_.ResetSupportedFormats(formats); | 208 capturer_.ResetSupportedFormats(formats); |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 capturer_.set_enable_camera_list(true); | 806 capturer_.set_enable_camera_list(true); |
| 840 capturer_.ConstrainSupportedFormats(vga_format); | 807 capturer_.ConstrainSupportedFormats(vga_format); |
| 841 EXPECT_EQ(2u, capturer_.GetSupportedFormats()->size()); | 808 EXPECT_EQ(2u, capturer_.GetSupportedFormats()->size()); |
| 842 // To make sure it's not just the camera list being broken, add in VGA and | 809 // To make sure it's not just the camera list being broken, add in VGA and |
| 843 // try again. This time, only the VGA format should be there. | 810 // try again. This time, only the VGA format should be there. |
| 844 supported_formats.push_back(vga_format); | 811 supported_formats.push_back(vga_format); |
| 845 capturer_.ResetSupportedFormats(supported_formats); | 812 capturer_.ResetSupportedFormats(supported_formats); |
| 846 ASSERT_EQ(1u, capturer_.GetSupportedFormats()->size()); | 813 ASSERT_EQ(1u, capturer_.GetSupportedFormats()->size()); |
| 847 EXPECT_EQ(vga_format.height, capturer_.GetSupportedFormats()->at(0).height); | 814 EXPECT_EQ(vga_format.height, capturer_.GetSupportedFormats()->at(0).height); |
| 848 } | 815 } |
| OLD | NEW |