208 Commits

Author SHA1 Message Date
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
Åsa Persson
2b679250fb VideoCapturerAndroid: Add possibility to request a new resolution from the video adapter.
BUG=
R=glaznev@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9434}
2015-06-15 07:53:16 +00:00
Alex Glaznev
782671f798 Improve Android HW decoder error handling.
- Remove an option to use MediaCodec SW decoder from Java layer.
- Better handling Java exceptions in JNI - detect exceptions
and either try to reset the codec or fallback to SW decoder.
- If any error is reported by codec try to fallback to SW
codec for VP8 or reset decoder and continue decoding for H.264.
- Add more logging for error conditions.

R=wzh@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9431}
2015-06-12 23:40:51 +00:00
Magnus Jedvert
80cf97cddd Android rendering: Move common EGL and GL functions to separate classes
This CL does not make any functional changes. The purpose is to extract some common code that is needed for texture capture and texture encode.

This CL does the following changes:
* Move common EGL functions from org.webrtc.MediaCodecVideoDecoder to org.webrtc.EglBase.
* Move common GL functions from org.webrtc.VideoRendererGui to org.webrtc.GlUtil and org.webrtc.GlShader.
* Remove unused call to surfaceTexture.getTransformMatrix in YuvImageRenderer.
* Add helper functions rotatedWidth()/rotatedHeight() in VideoRenderer.I420Frame.

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

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

Cr-Commit-Position: refs/heads/master@{#9414}
2015-06-11 08:09:15 +00:00
Peter Boström
eb66e800d1 Re-land "Convert native handles to buffers before encoding."
This reverts commit a67675506c9057bd9ffd4d76aae8b743343d434d.

BUG=webrtc:4081
TBR=magjed@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9381}
2015-06-05 09:08:12 +00:00
Tommi
a9952cdd0e Remove CHECK from GetThreadName.
It's safe for prctl() to fail, so we fall back on <noname> for thread names if we can't get one, instead of crashing.

BUG=
R=henrika@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9363}
2015-06-03 16:59:24 +00:00
Wan-Teh Chang
6b990744d9 Revert "Import org.junit.Assert instead of junit.framework.Assert."
This reverts commit a88470964c55dc655022d1f46370565aa3be535f.

It broke Android builds:
app/webrtc/java/testcommon/src/org/webrtc/PeerConnectionTest.java:46: error: package org.junit does not exist
import static org.junit.Assert.*;
                       ^
TBR=glaznev@webrtc.org,pthatcher@webrtc.org
BUG=none

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

Cr-Commit-Position: refs/heads/master@{#9357}
2015-06-02 21:36:32 +00:00
Wan-Teh Chang
a88470964c Import org.junit.Assert instead of junit.framework.Assert.
This fixed the warning:
app/webrtc/java/testcommon/src/org/webrtc/PeerConnectionTest.java:46: warning: [deprecation] Assert in junit.framework has been deprecated
import static junit.framework.Assert.*;

R=glaznev@webrtc.org, pthatcher@webrtc.org
BUG=none

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

Cr-Commit-Position: refs/heads/master@{#9356}
2015-06-02 21:26:48 +00:00
Peter Boström
308d163c71 Revert "Convert native handles to buffers before encoding."
This reverts commit a831dc3a7d10a1fbaa258ee6b1ca6cfc7e91c5ca to unblock
rolling into Chromium.

BUG=4081
TBR=magjed@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9354}
2015-06-02 13:04:31 +00:00
Peter Boström
a831dc3a7d Convert native handles to buffers before encoding.
Required to permit conversion of NV12 handles on iOS to I420 for VP8
software encoding, which blocks texture-based capture. This change
enforces that all texture-based input provides a method for converting
native handles to I420 if they are ever used with software encoders that
do not understand the native handles.

BUG=4081
R=emircan@chromium.org, glaznev@webrtc.org, hbos@webrtc.org, magjed@webrtc.org, mflodman@webrtc.org, stefan@webrtc.org, tkchin@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9347}
2015-06-01 18:06:52 +00:00
Henrik Lundin
5263b3c1dd Add options for NetEq fast accelerate mode through libjingle
This CL connects RTCConfiguration::audioJitterBufferFastMode in
PeerConnection.java, through libjingle, down to
NetEq::Config::enable_fast_accelerate in native WebRTC.

When enabled, it will allow NetEq to do faster time-compression when
the buffer level is very high.

BUG=4691
R=henrika@webrtc.org, mflodman@webrtc.org, pthatcher@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9344}
2015-06-01 08:29:55 +00:00