287 Commits

Author SHA1 Message Date
asapersson
ef5d5e45cb Add field trial for automic resize in MediaCodecVideoEncoder.
BUG=webrtc:4968

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

Cr-Commit-Position: refs/heads/master@{#10009}
2015-09-22 08:40:46 +00:00
Magnus Jedvert
c19922c181 Android SurfaceViewRenderer: Block in release() until frames are returned and cleanup is done
BUG=webrtc:4742,webrtc:4909
R=hbos@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10000}
2015-09-21 12:51:20 +00:00
Per
e6d3adab08 Re-add SurfaceTexture as member for setLocalPreview in VideoCapturerAndroid.
The Android camera api requires a surface to be set in order work. In https://codereview.webrtc.org/1354683004/ this surfaceTexture was removed as a member but it turns out that can lead to camera freezes when the device is rotated. This cl re-adds the surface as a member.

BUG= webrtc:5021, webrtc:5003
R=magjed@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9999}
2015-09-21 11:57:54 +00:00
perkj
780be75190 Make PeerConnectionTest.doTest wait for ice candidates
This change the PeerConnectionTest.doTest wait for at least one ice candidate and also make sure the list of candidates in gotIceCandidates is synchronized.

BUG=webrtc:5010

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

Cr-Commit-Position: refs/heads/master@{#9997}
2015-09-21 10:26:19 +00:00
Magnus Jedvert
4a783086b6 Android: Add helper class GlTextureFrameBuffer
BUG=webrtc:4993
R=hbos@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9991}
2015-09-18 14:32:24 +00:00
Per
3520f9e049 Removes camera.setPreviewTexture in doStopCaptureOnCameraThread and removes the try catch statement since the only method throwing an exception was setPreviewTexture.
BUG=webrtc:5003
R=magjed@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9985}
2015-09-18 09:52:58 +00:00
Patrik Höglund
e1c5ec72c6 Fixing bad merge (CHECK is now RTC_CHECK)
BUG=None
TBR=glaznev@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9975}
2015-09-17 15:20:43 +00:00
Patrik Höglund
fdd1b9a58e Reland: Bailing out if pc factory fails to get created.
This was reverted, but it turned out GOMA was down.

This prevents us from continuing if we fail initialization.
The failure will happen closer to its source, rather than
when we try to create the first peer connection.

BUG=None
R=glaznev@webrtc.org

Committed: https://crrev.com/6eb75d9e67f02c256436eb96f3c77026486561a1
Cr-Commit-Position: refs/heads/master@{#9948}

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

Cr-Commit-Position: refs/heads/master@{#9974}
2015-09-17 14:45:56 +00:00
henrikg
91d6edef35 Add RTC_ prefix to (D)CHECKs and related macros.
We must remove dependency on Chromium, i.e. we can't use Chromium's base/logging.h. That means we need to define these macros in WebRTC also when doing Chromium builds. And this causes redefinition.

Alternative solutions:
* Check if we already have defined e.g. CHECK, and don't define them in that case. This makes us depend on include order in Chromium, which is not acceptable.
* Don't allow using the macros in WebRTC headers. Error prone since if someone adds it there by mistake it may compile fine, but later break if a header in added or order is changed in Chromium. That will be confusing and hard to enforce.
* Ensure that headers that are included by an embedder don't include our macros. This would require some heavy refactoring to be maintainable and enforcable.
* Changes in Chromium for this is obviously not an option.

BUG=chromium:468375
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#9964}
2015-09-17 07:24:51 +00:00
Jiayang Liu
7754285f7c Log to the webrtc log stream from webrtc/modules java code.
The purpose is to gather all webrtc logging in a single place and allow the app to redirect all webrtc logging to a single stream for offline debugging.

Moved Logging.java to webrtc/base to be shared by talk/ and modules/.

R=glaznev@webrtc.org, henrika@webrtc.org, magjed@webrtc.org, tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9959}
2015-09-16 23:20:48 +00:00
Jiayang Liu
5975b3c5be Log to webrtc logging stream from java code.
Future log messages should all be sent to org.webrtc.Logging as well.

BUG=

Committed: https://crrev.com/66f0da2197974dcc1008f25df2bb4e1d463ad506
Cr-Commit-Position: refs/heads/master@{#9936}

R=glaznev@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9957}
2015-09-16 20:41:02 +00:00
henrikg
3c089d751e Add RTC_ prefix to contructormagic macros.
We must remove dependency on Chromium, i.e. we can't use Chromium's base/logging.h. That means we need to define these macros in WebRTC also when doing Chromium builds. And this causes redefinition.

* DISALLOW_ASSIGN -> RTC_DISALLOW_ASSIGN
* DISALLOW_COPY_AND_ASSIGN -> RTC_DISALLOW_COPY_AND_ASSIGN
* DISALLOW_IMPLICIT_CONSTRUCTORS -> RTC_DISALLOW_IMPLICIT_CONSTRUCTORS

Related CL: https://codereview.webrtc.org/1335923002/

BUG=chromium:468375
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#9953}
2015-09-16 12:37:52 +00:00
Magnus Jedvert
207370f0a2 Android MediaCodecVideoDecoder: Remove redundant useSurface arguments
This CL should not do any functional changes. It removes some redundant arguments and unnecessary error checking.

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

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

Cr-Commit-Position: refs/heads/master@{#9950}
2015-09-16 10:32:32 +00:00
phoglund
01ddf01d9c Revert of Bailing out if pc factory fails to get created. (patchset #1 id:1 of https://codereview.webrtc.org/1339923004/ )
Reason for revert:
Breaks goma (??!??!?)

Original issue's description:
> Bailing out if pc factory fails to get created.
>
> This prevents us from continuing if we fail initialization.
> The failure will happen closer to its source, rather than
> when we try to create the first peer connection.
>
> BUG=None
> R=glaznev@webrtc.org
>
> Committed: https://crrev.com/6eb75d9e67f02c256436eb96f3c77026486561a1
> Cr-Commit-Position: refs/heads/master@{#9948}

TBR=glaznev@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=None

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

Cr-Commit-Position: refs/heads/master@{#9949}
2015-09-16 07:03:44 +00:00
Patrik Höglund
6eb75d9e67 Bailing out if pc factory fails to get created.
This prevents us from continuing if we fail initialization.
The failure will happen closer to its source, rather than
when we try to create the first peer connection.

BUG=None
R=glaznev@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9948}
2015-09-16 06:41:42 +00:00
Alex Glaznev
2338fec627 Partial revert of r9936.
Need to figure out the best way to initialize native logging system
while peer connection factory is not created yet.

R=jiayl@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9947}
2015-09-15 23:07:45 +00:00
Alex Glaznev
32b5d23177 Add an option to avoid Java video track release when peer connection is closed.
Currently disposing Java peer connection object will result in auto
release of media streams and media tracks added to peer connection.
Add an option to allow application to own video track so it can be
kept after peer connection is destroyed.

R=jiayl@webrtc.org, wzh@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9946}
2015-09-15 18:09:42 +00:00
Magnus Jedvert
4ae28a1070 Android: Add SurfaceTextureHelper for creating and managing SurfaceTextures
Add new helper class to create and synchronize access to SurfaceTextures. The plan is replace the SurfaceTexture in MediaCodecVideoDecoder in a follow-up CL and remove the SurfaceTexture.updateTexImage() call in VideoRendererGui.

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

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

Cr-Commit-Position: refs/heads/master@{#9938}
2015-09-15 07:44:17 +00:00
jiayl
66f0da2197 Log to webrtc logging stream from java code.
Future log messages should all be sent to org.webrtc.Logging as well.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#9936}
2015-09-14 22:06:45 +00:00
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