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

Side by Side Diff: talk/app/webrtc/androidtests/src/org/webrtc/SurfaceTextureHelperTest.java

Issue 1465163003: Add SurfaceTextureHelper.disconnect(Handler handler) method (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed nit. Created 5 years, 1 month 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 | « no previous file | talk/app/webrtc/java/android/org/webrtc/SurfaceTextureHelper.java » ('j') | 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 2015 Google Inc. 3 * Copyright 2015 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); 306 GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
307 // swapBuffers() will ultimately trigger onTextureFrameAvailable(). 307 // swapBuffers() will ultimately trigger onTextureFrameAvailable().
308 eglOesBase.swapBuffers(); 308 eglOesBase.swapBuffers();
309 eglOesBase.release(); 309 eglOesBase.release();
310 310
311 // Wait for an OES texture to arrive. 311 // Wait for an OES texture to arrive.
312 listener.waitForNewFrame(); 312 listener.waitForNewFrame();
313 313
314 // Return the frame from this thread. 314 // Return the frame from this thread.
315 surfaceTextureHelper.returnTextureFrame(); 315 surfaceTextureHelper.returnTextureFrame();
316 surfaceTextureHelper.disconnect(); 316 surfaceTextureHelper.disconnect(handler);
317 thread.quitSafely(); 317 }
318
319 /**
320 * Test use SurfaceTextureHelper on a separate thread. A uniform texture frame is created and
321 * received on a thread separate from the test thread and returned after disco nnect.
322 */
323 @MediumTest
324 public static void testLateReturnFrameOnSeparateThread() throws InterruptedExc eption {
325 final HandlerThread thread = new HandlerThread("SurfaceTextureHelperTestThre ad");
326 thread.start();
327 final Handler handler = new Handler(thread.getLooper());
328
329 // Create SurfaceTextureHelper and listener.
330 final SurfaceTextureHelper surfaceTextureHelper =
331 SurfaceTextureHelper.create(EGL10.EGL_NO_CONTEXT, handler);
332 // Create a mock listener and expect frames to be delivered on |thread|.
333 final MockTextureListener listener = new MockTextureListener(thread);
334 surfaceTextureHelper.setListener(listener);
335
336 // Create resources for stubbing an OES texture producer. |eglOesBase| has t he
337 // SurfaceTexture in |surfaceTextureHelper| as the target EGLSurface.
338 final EglBase eglOesBase = new EglBase(EGL10.EGL_NO_CONTEXT, EglBase.ConfigT ype.PLAIN);
339 eglOesBase.createSurface(surfaceTextureHelper.getSurfaceTexture());
340 eglOesBase.makeCurrent();
341 // Draw a frame onto the SurfaceTexture.
342 GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
343 // swapBuffers() will ultimately trigger onTextureFrameAvailable().
344 eglOesBase.swapBuffers();
345 eglOesBase.release();
346
347 // Wait for an OES texture to arrive.
348 listener.waitForNewFrame();
349
350 surfaceTextureHelper.disconnect(handler);
351
352 surfaceTextureHelper.returnTextureFrame();
318 } 353 }
319 } 354 }
OLDNEW
« no previous file with comments | « no previous file | talk/app/webrtc/java/android/org/webrtc/SurfaceTextureHelper.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698