218 Commits

Author SHA1 Message Date
Magnus Jedvert
ea06a58f40 Android video capture: Remove duplicated code and fix spelling mistakes
This CL does not contain any functional changes, it is purely nit fixes.

R=hbos@webrtc.org

Review URL: https://codereview.webrtc.org/1340923002 .

Cr-Commit-Position: refs/heads/master@{#9931}
2015-09-14 14:10:53 +00:00
colin
92068ee683 Android: Guard against switching camera on stopped camera
It is possible that cameraThreadHandler is null upon calling
switchCamera(). This CL adds a guard against that.

Review URL: https://codereview.webrtc.org/1325333003

Cr-Commit-Position: refs/heads/master@{#9925}
2015-09-11 13:30:37 +00:00
Magnus Jedvert
c06a716d59 Android: Add new renderer SurfaceViewRenderer
BUG=webrtc:4742,webrtc:4910
R=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1308223002 .

Cr-Commit-Position: refs/heads/master@{#9922}
2015-09-11 07:51:59 +00:00
Magnus Jedvert
c2db810b89 Remove VideoRendererInterface::CanApplyRotation()
All implementations handle rotation now, both internally in WebRTC and externally in Chromium.

R=glaznev@webrtc.org, guoweis@webrtc.org

Review URL: https://codereview.webrtc.org/1313753003 .

Cr-Commit-Position: refs/heads/master@{#9911}
2015-09-09 19:26:19 +00:00
Magnus Jedvert
8ce0bd54e9 Android video rendering: Fix texture matrix multiplication order
BUG=webrtc:4968, webrtc:4742
R=hbos@webrtc.org, pbos@webrtc.org

Review URL: https://codereview.webrtc.org/1314163008 .

Cr-Commit-Position: refs/heads/master@{#9909}
2015-09-09 16:51:17 +00:00
Magnus Jedvert
529528cc36 Android video rendering: Apply SurfaceTexture.getTransformationMatrix()
This CL applies the transformation matrix instead of assuming it is always a vertical flip.

BUG=webrtc:4968,webrtc:4742
R=hbos@webrtc.org, pbos@webrtc.org

Review URL: https://codereview.webrtc.org/1318153007 .

Cr-Commit-Position: refs/heads/master@{#9905}
2015-09-09 09:00:14 +00:00
Magnus Jedvert
7764973e1d Add magjed@ as owner for talk/app/webrtc/androidtests/ and talk/app/webrtc/java/jni/
magjed@ has done a lot of work in these folders.

R=tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1314123004 .

Cr-Commit-Position: refs/heads/master@{#9896}
2015-09-08 15:13:45 +00:00
Magnus Jedvert
e7a0de773a CameraEnumerationAndroid: Add getSupportedFormats() implementation using android.hardware.camera2
Enumerating using android.hardware.camera2 is 10x faster than enumerating using android.hardware.camera, but they don't list exactly the same formats. android.hardware.camera2 support higher resolutions for some cameras, and also different framerates.

R=tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1321893003 .

Cr-Commit-Position: refs/heads/master@{#9861}
2015-09-04 13:13:39 +00:00
Magnus Jedvert
7afc12fe91 VideoRendererGui: Move to async rendering and remove no longer needed code
BUG=webrtc:4742, webrtc:4909
R=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1321853003 .

Cr-Commit-Position: refs/heads/master@{#9847}
2015-09-03 10:40:50 +00:00
Magnus Jedvert
1a591ddc7e Android GlUtil: Add helper functions generateTexture/deleteTexture
The purpose with this CL is to remove some code bloat. A subtle change is that GL_TEXTURE_MIN_FILTER in MediaCodecVideoDecoder is changed from GL_NEAREST to GL_LINEAR. This may lead to slightly worse performance when the decoded video is rendered minified, but with better visual quality. After reading https://crbug.com/351458 and the fix https://codereview.chromium.org/713603002 I think this is the right choice.

BUG=webrtc:4742
R=hbos@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1303373005 .

Cr-Commit-Position: refs/heads/master@{#9845}
2015-09-02 12:43:18 +00:00
Magnus Jedvert
ed4224fbda Android GlRectDrawer: Add fragment shader for RGB(A) textures
Add third shader type for RGB(A) and refactor according to the Rule of three.

BUG=webrtc:4742
R=hbos@webrtc.org

Review URL: https://codereview.webrtc.org/1311093005 .

Cr-Commit-Position: refs/heads/master@{#9843}
2015-09-02 10:52:10 +00:00
Jiayang Liu
e63d2a1c62 Add JNI/java wrapper for the file rotating logging class.
BUG=
R=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1309073004 .

Cr-Commit-Position: refs/heads/master@{#9840}
2015-09-01 23:11:28 +00:00
Alex Glaznev
4d2f4d1c69 - Make shared EGL context used for HW video decoding member
of decoder factory class.
- Add new Peer connection factory method to initialize shared
EGL context.

This provides an option to use single peer connection factory
in the application and create peer connections from the same
factory and reinitialize shared EGL context for video
decoding HW acceleration.

R=wzh@webrtc.org

Review URL: https://codereview.webrtc.org/1304063011 .

Cr-Commit-Position: refs/heads/master@{#9838}
2015-09-01 22:04:21 +00:00
glaznev
97579a4e12 Add option to enable ECDSA key for Java API.
Review URL: https://codereview.webrtc.org/1312293003

Cr-Commit-Position: refs/heads/master@{#9835}
2015-09-01 18:31:34 +00:00
magjed
eebc0996bf Add magjed@ as owner for talk/app/webrtc/java/android/org/webrtc/
magjed@ has done a lot of work in this folder.

Review URL: https://codereview.webrtc.org/1322133002

Cr-Commit-Position: refs/heads/master@{#9834}
2015-09-01 18:09:28 +00:00
Alex Glaznev
194cceadae Do not use HW H.264 encoder on Nexus 7.
H.264 HW encoder on some Nexus 7 models have
poor bitrate control.

R=jiayl@webrtc.org

Review URL: https://codereview.webrtc.org/1311893009 .

Cr-Commit-Position: refs/heads/master@{#9833}
2015-09-01 17:36:49 +00:00
honghaiz
4edc39c569 Set the IceConnectionReceivingTimeout as a RTCConfiguration parameter.
BUG= 4901

Review URL: https://codereview.webrtc.org/1315503003

Cr-Commit-Position: refs/heads/master@{#9832}
2015-09-01 16:54:02 +00:00
Magnus Jedvert
c252dabbd6 CameraEnumerationAndroid: Make getSupportedFormats() an interface
Enumerating camera capabilities in the deprecated android.hardware.Camera interface is really slow because of the need to open and release the camera. By making getSupportedFormats() an interface, we allow apps the opportunity to inject their own implementation, such as storing the supported formats offline in the device's internal storage. It will also be possible to add an implementation of getSupportedFormats() using the new android.hardware.Camera2 interface in a follow-up CL.

R=tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1321903002 .

Cr-Commit-Position: refs/heads/master@{#9819}
2015-08-31 11:19:20 +00:00
Magnus Jedvert
a6cba3ab5c Java VideoRenderer.Callbacks: Make renderFrame() interface asynchronous
This CL makes the Java render interface asynchronous by requiring every call to renderFrame() to be followed by an explicit renderFrameDone() call. In JNI, this is implemented with cricket::VideoFrame::Copy() before calling renderFrame(), and a corresponding call to delete in renderFrameDone(). This CL is primarily done to prepare for a new renderer implementation.

BUG=webrtc:4742, webrtc:4909
R=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1313563002 .

Cr-Commit-Position: refs/heads/master@{#9814}
2015-08-29 13:57:56 +00:00
Alex Glaznev
79de90b110 Do not explicitly delete OpenGL shaders in VideoRendererGui.
This is handled by Android itself and may result in GL errors
when trying to release shaders when Activity is destroyed.

R=wzh@webrtc.org

Review URL: https://codereview.webrtc.org/1322703004 .

Cr-Commit-Position: refs/heads/master@{#9811}
2015-08-28 18:47:46 +00:00
magjed
6813ec84fb VideoCapturerAndroid: Move to android folder and split out camera enumeration into separate file
Pure code move of:
talk/app/webrtc/java/src/org/webrtc/VideoCapturerAndroid.java
into:
talk/app/webrtc/java/android/org/webrtc/VideoCapturerAndroid.java
talk/app/webrtc/java/android/org/webrtc/CameraEnumerationAndroid.java

NOPRESUBMIT=true

Review URL: https://codereview.webrtc.org/1323453002

Cr-Commit-Position: refs/heads/master@{#9809}
2015-08-28 12:22:27 +00:00
phoglund
6480d03f17 Make jni_helpers build on arm32.
BUG=None

Review URL: https://codereview.webrtc.org/1311753002

Cr-Commit-Position: refs/heads/master@{#9806}
2015-08-28 09:58:45 +00:00
Magnus Jedvert
1c3dd38cb8 Android: Fix memory leak for remote MediaStream
BUG=webrtc:4892
R=glaznev@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1308733004 .

Cr-Commit-Position: refs/heads/master@{#9797}
2015-08-27 11:40:09 +00:00
Alex Glaznev
c47a01d647 Fix AppRTCDemo crash when room is connected after PC is destroyed.
Also move VideoRendererGui.dispose() to the section with public API.

BUG=4909
R=wzh@webrtc.org

Review URL: https://codereview.webrtc.org/1312523004 .

Cr-Commit-Position: refs/heads/master@{#9792}
2015-08-26 23:02:29 +00:00
Magnus Jedvert
c464f504dc AndroidVideoCapturerJni: Fix threading issues
The primary fix in this CL is to remove the dangling |thread_| pointer in AndroidVideoCapturerJni. That thread is not safe to use after Stop() has been called. Even after Stop() has been called, we must still be able to return late frames to Java in order to not leak them, so that path has been made thread safe instead. To make sure that we always return frames, the Java frame should be wrapped in a scoped_refptr as quickly as possible, so this CL moves the wrapping from AndroidVideoCapturer to AndroidVideoCapturerJni. This also removes the need for the interface function AndroidVideoCapturerDelegate::ReturnBuffer().

Some other minor changes are:
 * Remove |valid_global_refs_| and all logic related to that. Now that rtc::Bind() captures method objects as scoped_refptr, the destructor of AndroidVideoCapturerJni will not be called before all frames are returned.
 * Remove global ref |j_frame_observer_|. No need for this, we don’t call it and it is kept alive with standard Java memory management.
 * Add helper function ShallowCenterCrop() for VideoFrameBuffers. This functionality already exists in the constructor of WrappedI420Buffer, but it’s more convenient to have it as a separate function.

BUG=webrtc:4742,webrtc:4909
R=glaznev@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1307973002 .

Cr-Commit-Position: refs/heads/master@{#9784}
2015-08-25 21:22:24 +00:00
Magnus Jedvert
7230a21d66 Android RendererCommon: Add unittests for getDisplaySize()
BUG=webrtc:4742
R=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1313513002 .

Cr-Commit-Position: refs/heads/master@{#9777}
2015-08-25 10:31:30 +00:00
Magnus Jedvert
7ef9d9104d Android: Remove VideoRenderer.Callbacks.canApplyRotation()
The only real implementation of VideoRenderer.Callbacks, VideoRendererGui, can always apply rotation. We don't need this in the interface.

BUG=webrtc:4145
R=glaznev@webrtc.org, guoweis@webrtc.org

Review URL: https://codereview.webrtc.org/1306073003 .

Cr-Commit-Position: refs/heads/master@{#9772}
2015-08-25 07:32:16 +00:00
Magnus Jedvert
ff020c01ca Android: Move common functions from VideoRendererGui to new RendererCommon file
This is primarily done to prepare for a new renderer implementation.

BUG=webrtc:4742
R=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1298673002 .

Cr-Commit-Position: refs/heads/master@{#9742}
2015-08-20 12:03:17 +00:00
Magnus Jedvert
d476b95504 Android EglBase: Add helper functions to query the surface size
BUG=webrtc:4742
R=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1299543004 .

Cr-Commit-Position: refs/heads/master@{#9739}
2015-08-20 07:58:44 +00:00
Alex Glaznev
55e9a7dc4b Add Android VideoRendererGui events.
Add events to Android VideoRendererGui implementation to
optionally report first rendered frame and video frame
dimension changes.

R=wzh@webrtc.org

Review URL: https://codereview.webrtc.org/1292293002 .

Cr-Commit-Position: refs/heads/master@{#9715}
2015-08-14 18:46:43 +00:00
magjed
d5031fcf92 Android VideoRendererGui: Add dispose function
There is currently no way to dispose VideoRendererGui or VideoRendererGui.YuvImageRenderer. This CL adds functions to do so.

BUG=webrtc:4892

Review URL: https://codereview.webrtc.org/1273803002

Cr-Commit-Position: refs/heads/master@{#9710}
2015-08-14 10:13:08 +00:00
magjed
af5c035e43 VideoCapturerAndroid: Release queued camera frames when stopCapture() is called
BUG=webrtc:4892

Review URL: https://codereview.webrtc.org/1285823002

Cr-Commit-Position: refs/heads/master@{#9709}
2015-08-14 09:42:22 +00:00
magjed
e2a8be1244 Revert of AppRTCDemo: Render each video in a separate SurfaceView (patchset #4 id:120001 of https://codereview.webrtc.org/1257043004/ )
Reason for revert:
AppRTCDemo often crashes in loopback mode and incorrect layout when connection is established

BUG=webrtc:4909,webrtc:4910

Original issue's description:
> AppRTCDemo: Render each video in a separate SurfaceView
>
> This CL introduces a new org.webrtc.VideoRenderer.Callbacks implementation called SurfaceViewRenderer that renders each video stream in its own SurfaceView. AppRTCDemo is updated to use this new rendering.
>
> This CL also does the following changes:
> * Make the VideoRenderer.Callbacks interface asynchronous and require that renderFrameDone() is called for every renderFrame(). In JNI, this is implemented with cricket::VideoFrame::Copy()/delete.
> * Make public static helper functions: convertScalingTypeToVisibleFraction(), getDisplaySize(), and getTextureMatrix().
> * Introduces new helper functions surfaceWidth()/surfaceHeight() in EGlBase that allows to query the surface size.
> * Introduce PercentFrameLayout that implements the percentage layout that is used by AppRTCDemo.
>
> BUG=webrtc:4742
>
> Committed: https://crrev.com/05bfbe47ef6bcc9ca731c0fa0d5cd15a4f21e93f
> Cr-Commit-Position: refs/heads/master@{#9699}

TBR=glaznev@webrtc.org,wzh@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4742

Review URL: https://codereview.webrtc.org/1286133002

Cr-Commit-Position: refs/heads/master@{#9703}
2015-08-12 06:55:04 +00:00
budnyjj
d941b7609c Fix distortions of remote stream with odd size dimensions
BUG=webrtc:4482

Review URL: https://codereview.webrtc.org/1280483003

Cr-Commit-Position: refs/heads/master@{#9702}
2015-08-12 03:29:03 +00:00
Alex Glaznev
8a2cd3d57d Revert H.264 HW encoder setting to CBR mode.
VBR mode does not work well on KK devices - bitrate
deviations from target are too large,

R=wzh@webrtc.org

Review URL: https://codereview.webrtc.org/1270403007 .

Cr-Commit-Position: refs/heads/master@{#9701}
2015-08-11 18:33:03 +00:00
magjed
05bfbe47ef AppRTCDemo: Render each video in a separate SurfaceView
This CL introduces a new org.webrtc.VideoRenderer.Callbacks implementation called SurfaceViewRenderer that renders each video stream in its own SurfaceView. AppRTCDemo is updated to use this new rendering.

This CL also does the following changes:
* Make the VideoRenderer.Callbacks interface asynchronous and require that renderFrameDone() is called for every renderFrame(). In JNI, this is implemented with cricket::VideoFrame::Copy()/delete.
* Make public static helper functions: convertScalingTypeToVisibleFraction(), getDisplaySize(), and getTextureMatrix().
* Introduces new helper functions surfaceWidth()/surfaceHeight() in EGlBase that allows to query the surface size.
* Introduce PercentFrameLayout that implements the percentage layout that is used by AppRTCDemo.

BUG=webrtc:4742

Review URL: https://codereview.webrtc.org/1257043004

Cr-Commit-Position: refs/heads/master@{#9699}
2015-08-11 13:50:27 +00:00
Alex Glaznev
0482dcc873 Enable HW H.264 decoding on Intel platforms.
R=wzh@webrtc.org

Review URL: https://codereview.webrtc.org/1274133003 .

Cr-Commit-Position: refs/heads/master@{#9686}
2015-08-06 22:17:03 +00:00
magjed
37ec7330b4 VideoCapturerAndroid: Check if data is null in onPreviewFrame()
onPreviewFrame() might be called with a null data pointer, which is allowed according to the documentation.

BUG=webrtc:4877

Review URL: https://codereview.webrtc.org/1260183004

Cr-Commit-Position: refs/heads/master@{#9674}
2015-08-05 07:34:55 +00:00
Alex Glaznev
0c850202fe Add list of devices with HW H.264 encoder non suitable for WebRTC.
For now add only Galaxy S4 to the list, since its H.264 HW encoder
generates two times lower bitrate comparing to target.
Also use VBR mode for H.264 encoder configuration.

R=wzh@webrtc.org

Review URL: https://codereview.webrtc.org/1270603007 .

Cr-Commit-Position: refs/heads/master@{#9673}
2015-08-04 17:27:06 +00:00
magjed
b28678ce70 Add unittest to GlRectDrawer
Review URL: https://codereview.webrtc.org/1250093003

Cr-Commit-Position: refs/heads/master@{#9638}
2015-07-26 12:17:25 +00:00
magjed
013a580064 VideoCapturerAndroid: Revert elapsedRealtimeNanos to elapsedRealtime
Review URL: https://codereview.webrtc.org/1254143002

Cr-Commit-Position: refs/heads/master@{#9637}
2015-07-26 11:25:14 +00:00
jackychen
e2b34b7b4b Bug fix: camera frames are dropped before wideo encoder.
https://code.google.com/p/webrtc/issues/detail?id=4871

R=glaznev@webrtc.org
TBR=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1260543002 .

Cr-Commit-Position: refs/heads/master@{#9634}
2015-07-24 21:12:31 +00:00
magjed
b69ab79338 VideoCapturerAndroid: Add function to change capture format while camera is running
Review URL: https://codereview.webrtc.org/1178703009

Cr-Commit-Position: refs/heads/master@{#9608}
2015-07-22 09:32:04 +00:00
jackychen
6e2ce6e1ae Allow for framerate reduction for HW encoder.
R=pbos@webrtc.org, stefan@webrtc.org
TBR=glaznev@google.com

Review URL: https://webrtc-codereview.appspot.com/51159004 .

Cr-Commit-Position: refs/heads/master@{#9573}
2015-07-13 23:26:40 +00:00
honghaiz
900996290c Add methods to set the ICE connection receiving_timeout values.
BUG=

Review URL: https://codereview.webrtc.org/1231913003

Cr-Commit-Position: refs/heads/master@{#9572}
2015-07-13 19:19:42 +00:00
Jiayang Liu
61093868b4 Expose the disable encryption option to JNI.
BUG=
R=glaznev@webrtc.org

Review URL: https://codereview.webrtc.org/1230613002 .

Cr-Commit-Position: refs/heads/master@{#9554}
2015-07-08 22:25:56 +00:00
Peter Thatcher
54360510ff Add flakyness check based on the recently received packets.
BUG=
R=pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1207563002 .

Cr-Commit-Position: refs/heads/master@{#9553}
2015-07-08 18:08:39 +00:00
bemasc
0edd50ccb3 Support for onbufferedamountlow
Original review at https://webrtc-codereview.appspot.com/54679004/

BUG=https://code.google.com/p/chromium/issues/detail?id=496700

Review URL: https://codereview.webrtc.org/1207613006

Cr-Commit-Position: refs/heads/master@{#9527}
2015-07-01 20:34:42 +00:00
magjed
59a677ada2 Android VideoRendererGui: Refactor GLES rendering
This CL should not change any visible behaviour. It does the following:
 * Extract GLES rendering into separate class GlRectDrawer. This class is also needed for future video encode with OES texture input.
 * Clean up current ScalingType -> display size calculation and introduce new SCALE_ASPECT_BALANCED (b/21735609) and remove unused SCALE_FILL.
 * Replace current mirror/rotation index juggling with android.opengl.Matrix operations instead.

Review URL: https://codereview.webrtc.org/1191243005

Cr-Commit-Position: refs/heads/master@{#9496}
2015-06-24 10:59:43 +00:00
phoglund
7ab5f801dd Adding an equals method for KeyValuePair for easier testing.
With this we can write stuff like

assertThat(result.mandatory,
    hasItem(new KeyValuePair("minWidth", "1280")));

The above will currently fail because the object falls back to ==.

BUG=None

Review URL: https://codereview.webrtc.org/1193883006

Cr-Commit-Position: refs/heads/master@{#9494}
2015-06-24 08:11:51 +00:00