OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 eglRenderer.addFrameListener(testFrameListener, 0f); | 303 eglRenderer.addFrameListener(testFrameListener, 0f); |
304 eglRenderer.removeFrameListener(testFrameListener); | 304 eglRenderer.removeFrameListener(testFrameListener); |
305 feedFrame(1); | 305 feedFrame(1); |
306 } | 306 } |
307 // Check the frame listener hasn't triggered. | 307 // Check the frame listener hasn't triggered. |
308 assertFalse(testFrameListener.waitForBitmap(RENDER_WAIT_MS)); | 308 assertFalse(testFrameListener.waitForBitmap(RENDER_WAIT_MS)); |
309 } | 309 } |
310 | 310 |
311 @Test | 311 @Test |
312 @SmallTest | 312 @SmallTest |
313 public void testFrameListenersWhilePaused() throws Exception { | 313 public void testFrameListenersFpsReduction() throws Exception { |
314 // Test that frame listeners receive frames while renderer is paused. | 314 // Test that normal frame listeners receive frames while the renderer is pau
sed. |
315 eglRenderer.pauseVideo(); | 315 eglRenderer.pauseVideo(); |
316 eglRenderer.addFrameListener(testFrameListener, 1f /* scaleFactor */); | 316 eglRenderer.addFrameListener(testFrameListener, 1f /* scaleFactor */); |
317 feedFrame(0); | 317 feedFrame(0); |
318 assertTrue(testFrameListener.waitForBitmap(RENDER_WAIT_MS)); | 318 assertTrue(testFrameListener.waitForBitmap(RENDER_WAIT_MS)); |
319 checkBitmapContent(testFrameListener.resetAndGetBitmap(), 0); | 319 checkBitmapContent(testFrameListener.resetAndGetBitmap(), 0); |
| 320 |
| 321 // Test that frame listeners with FPS reduction applied receive frames while
the renderer is not |
| 322 // paused. |
| 323 eglRenderer.disableFpsReduction(); |
| 324 eglRenderer.addFrameListener( |
| 325 testFrameListener, 1f /* scaleFactor */, null, true /* applyFpsReduction
*/); |
| 326 feedFrame(1); |
| 327 assertTrue(testFrameListener.waitForBitmap(RENDER_WAIT_MS)); |
| 328 checkBitmapContent(testFrameListener.resetAndGetBitmap(), 1); |
| 329 |
| 330 // Test that frame listeners with FPS reduction applied will not receive fra
mes while the |
| 331 // renderer is paused. |
| 332 eglRenderer.pauseVideo(); |
| 333 eglRenderer.addFrameListener( |
| 334 testFrameListener, 1f /* scaleFactor */, null, true /* applyFpsReduction
*/); |
| 335 feedFrame(1); |
| 336 assertFalse(testFrameListener.waitForBitmap(RENDER_WAIT_MS)); |
320 } | 337 } |
321 } | 338 } |
OLD | NEW |