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

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

Issue 1372813002: Android VideoCapturer: Send ByteBuffer instead of byte[] (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 | « no previous file | talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.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 17 matching lines...) Expand all
28 28
29 import android.hardware.Camera; 29 import android.hardware.Camera;
30 import android.test.ActivityTestCase; 30 import android.test.ActivityTestCase;
31 import android.test.suitebuilder.annotation.SmallTest; 31 import android.test.suitebuilder.annotation.SmallTest;
32 import android.test.suitebuilder.annotation.MediumTest; 32 import android.test.suitebuilder.annotation.MediumTest;
33 import android.util.Size; 33 import android.util.Size;
34 34
35 import org.webrtc.CameraEnumerationAndroid.CaptureFormat; 35 import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
36 import org.webrtc.VideoRenderer.I420Frame; 36 import org.webrtc.VideoRenderer.I420Frame;
37 37
38 import java.nio.ByteBuffer;
38 import java.util.ArrayList; 39 import java.util.ArrayList;
39 import java.util.HashSet; 40 import java.util.HashSet;
40 import java.util.List; 41 import java.util.List;
41 import java.util.Set; 42 import java.util.Set;
42 import java.util.concurrent.CountDownLatch; 43 import java.util.concurrent.CountDownLatch;
43 44
44 @SuppressWarnings("deprecation") 45 @SuppressWarnings("deprecation")
45 public class VideoCapturerAndroidTest extends ActivityTestCase { 46 public class VideoCapturerAndroidTest extends ActivityTestCase {
46 static class RendererCallbacks implements VideoRenderer.Callbacks { 47 static class RendererCallbacks implements VideoRenderer.Callbacks {
47 private int framesRendered = 0; 48 private int framesRendered = 0;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 98
98 @Override 99 @Override
99 public void OnCapturerStarted(boolean success) { 100 public void OnCapturerStarted(boolean success) {
100 synchronized (capturerStartLock) { 101 synchronized (capturerStartLock) {
101 captureStartResult = success; 102 captureStartResult = success;
102 capturerStartLock.notify(); 103 capturerStartLock.notify();
103 } 104 }
104 } 105 }
105 106
106 @Override 107 @Override
107 public void OnFrameCaptured(byte[] frame, int length, int width, int height, 108 public void OnFrameCaptured(ByteBuffer frame, int width, int height,
108 int rotation, long timeStamp) { 109 int rotation, long timeStamp) {
109 synchronized (frameLock) { 110 synchronized (frameLock) {
110 ++framesCaptured; 111 ++framesCaptured;
111 frameSize = length; 112 frameSize = frame.capacity();
hbos 2015/09/28 12:35:51 Should limit() be used instead of capacity()? Or m
magjed_webrtc 2015/09/28 14:42:42 I know for sure that capacity() is exactly like pr
112 timestamps.add(timeStamp); 113 timestamps.add(timeStamp);
113 frameLock.notify(); 114 frameLock.notify();
114 } 115 }
115 } 116 }
116 117
117 @Override 118 @Override
118 public void OnOutputFormatRequest(int width, int height, int fps) {} 119 public void OnOutputFormatRequest(int width, int height, int fps) {}
119 120
120 public boolean WaitForCapturerToStart() throws InterruptedException { 121 public boolean WaitForCapturerToStart() throws InterruptedException {
121 synchronized (capturerStartLock) { 122 synchronized (capturerStartLock) {
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 } 450 }
450 } 451 }
451 }); 452 });
452 returnThread.start(); 453 returnThread.start();
453 returnThread.join(); 454 returnThread.join();
454 455
455 // Check that frames have successfully returned. This will cause |capturer| to be released. 456 // Check that frames have successfully returned. This will cause |capturer| to be released.
456 assertTrue(capturer.isReleased()); 457 assertTrue(capturer.isReleased());
457 } 458 }
458 } 459 }
OLDNEW
« no previous file with comments | « no previous file | talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698