Commit Graph

287 Commits

Author SHA1 Message Date
ec93628e75 Fix use of scaler in MediaCodecVideoEncoder
This bug fixes an issue introduced in https://codereview.webrtc.org/1396073003/

BUG=webrtc:5067
TEST= set new_bit_rate = 200 in MediaCodecVideoEncoder::SetRatesOnCodecThread and compile and run ApprtDemo
R=magjed@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10263}
2015-10-13 12:04:08 +00:00
325d414e8c Add option to print peer connection factory Java stack traces.
Removing static declaration for media codec thread to allow
running multiple HW codec instances.

R=wzh@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10258}
2015-10-12 21:56:09 +00:00
a5b62d987a Replace API v23 calls.
R=jiayl@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10257}
2015-10-12 20:56:29 +00:00
52a30e31f1 Reland of Android: Put common native VideoFrameBuffer implementation in androidvideocapturer_jni (patchset #1 id:1 of https://codereview.webrtc.org/1389283003/ )
Reason for revert:
Nothing wrong with the original CL, the bug was in rtc::Bind(), which is fixed now (https://codereview.webrtc.org/1403683004/).

Original issue's description:
> Revert of Android: Put common native VideoFrameBuffer implementation in androidvideocapturer_jni (patchset #1 id:1 of https://codereview.webrtc.org/1391403004/ )
>
> Reason for revert:
> Crashes on AppRTCDemo disconnect
>
> Original issue's description:
> > Android: Put common native VideoFrameBuffer implementation in native_handle_impl.cc
> >
> > BUG=webrtc:4993
> > R=perkj@webrtc.org
> >
> > Committed: https://crrev.com/60472216da0644b49ed5f9fa51c51d4874afafa7
> > Cr-Commit-Position: refs/heads/master@{#10248}
>
> TBR=perkj@webrtc.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4993
>
> Committed: https://crrev.com/962c26bfd6c3eb3cf7402daaab89404ae38dd534
> Cr-Commit-Position: refs/heads/master@{#10249}

TBR=perkj@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4993

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

Cr-Commit-Position: refs/heads/master@{#10254}
2015-10-12 13:53:27 +00:00
90754174d9 Prepare MediaCodecVideoEncoder for surface textures.
This make small refactorings to MediaVideoEncoder to prepare for adding support to encode from textures. The C++ layer does not have any functional changes.
- Moves ResetEncoder to always work on the codec thread
- Adds use of ThreadChecker.
- Change Java MediaEncoder.Init to return true or false and introduce method getInputBuffers.
- Add simple unit test for Java MediaCodecVideoEncoder.

BUG=webrtc:4993

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

Cr-Commit-Position: refs/heads/master@{#10250}
2015-10-12 10:04:22 +00:00
962c26bfd6 Revert of Android: Put common native VideoFrameBuffer implementation in androidvideocapturer_jni (patchset #1 id:1 of https://codereview.webrtc.org/1391403004/ )
Reason for revert:
Crashes on AppRTCDemo disconnect

Original issue's description:
> Android: Put common native VideoFrameBuffer implementation in native_handle_impl.cc
>
> BUG=webrtc:4993
> R=perkj@webrtc.org
>
> Committed: https://crrev.com/60472216da0644b49ed5f9fa51c51d4874afafa7
> Cr-Commit-Position: refs/heads/master@{#10248}

TBR=perkj@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4993

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

Cr-Commit-Position: refs/heads/master@{#10249}
2015-10-12 09:26:43 +00:00
60472216da Android: Put common native VideoFrameBuffer implementation in native_handle_impl.cc
BUG=webrtc:4993
R=perkj@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10248}
2015-10-12 07:36:16 +00:00
747c1bccd9 Android SurfaceTextureHelper: Replace API 21 with API 11 version of setOnFrameAvailableListener()
BUG=b/24809429
R=glaznev@webrtc.org, perkj@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10247}
2015-10-12 07:27:56 +00:00
e9e3668759 Android: Add helper function to synchronously execute Callables on Handler
TBR=hbos

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

Cr-Commit-Position: refs/heads/master@{#10246}
2015-10-12 07:15:57 +00:00
69ddaefbb3 Revert "Add option to print peer connection factory Java stack traces."
This reverts commit b68c5995d1ac84866da45a4ecbb180d8c704ad90.

Reason for reverting: It breaks some Android32 bots.

TBR=glaznev@google.com

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

Cr-Commit-Position: refs/heads/master@{#10239}
2015-10-09 22:46:17 +00:00
b68c5995d1 Add option to print peer connection factory Java stack traces.
Updated version with better handling of media codec release checks.

R=wzh@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10238}
2015-10-09 20:58:37 +00:00
fd20bb3e80 Revert "Allow to print Java stack traces in Android camera, renderer and media codec."
Reason for revert: It breaks some Android32 bots.

TBR=glaznev@google.com

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

Cr-Commit-Position: refs/heads/master@{#10231}
2015-10-09 01:13:48 +00:00
2b298de100 Reset media codec thread when Encoder/Decoder object is created.
Review URL: https://codereview.webrtc.org/1389373004 .

Cr-Commit-Position: refs/heads/master@{#10230}
2015-10-08 23:22:12 +00:00
f0159a742f Allow to print Java stack traces in Android camera, renderer and media codec.
R=wzh@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10227}
2015-10-08 19:59:30 +00:00
e76fb36982 Android SurfaceViewRenderer: Add tests for onMeasure()
BUG=webrtc:4742
R=hbos@webrtc.org, perkj@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10224}
2015-10-08 17:05:34 +00:00
bf2004bc37 Android SurfaceViewRenderer: Only clear image in release() if initialized
This CL is a small bug fix for "Android SurfaceViewRenderer: Allow to re-init after release() has been called" https://codereview.webrtc.org/1389203003/. It is only possible to clear the last image in release() if init() has been called beforehand.

TBR=hbos
BUG=webrtc:4742

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

Cr-Commit-Position: refs/heads/master@{#10223}
2015-10-08 16:58:33 +00:00
ac30642461 Native changes for VideoCapturerAndroid surface texture support
These are the necessary changes in C++ related to the video capturer necessary to capture to a surface texture.
It does not handle scaling / cropping yet though.

BUG=
R=magjed@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10218}
2015-10-08 13:32:45 +00:00
4382d800d2 Android SurfaceViewRenderer: Allow to re-init after release() has been called
This CL makes a thorough reset of all variables in release() and clears the last rendered image so that the SurfaceViewRenderer object can be reinitialized with init() and work properly. This CL also removes an implicit assumption that init() is called before surfaceCreated() - now they can be called in any order.

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

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

Cr-Commit-Position: refs/heads/master@{#10217}
2015-10-08 12:45:42 +00:00
3d06eca5e3 Add support to Capture to a texture instead of memory.
This adds support for capturing to a texture in the Java part of VideoCapturerAndroid.
After this cl, the C++ also needs modification.

https://codereview.webrtc.org/1375953002/ contains the idea and have a working version where textures can be rendered in local preview.

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

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

Cr-Commit-Position: refs/heads/master@{#10213}
2015-10-08 10:53:46 +00:00
fddf6e526c Use WebRTC logging in MediaCodec JNI code.
Also enable HW encoder scaling in AppRTCDemo.

R=wzh@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10205}
2015-10-07 23:51:20 +00:00
21622a1d19 Add option to print peer connection factory Java stack traces.
R=wzh@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10204}
2015-10-07 21:50:21 +00:00
91b348c702 Android MediaCodecVideoDecoder: Manage lifetime of texture frames
This CL should be the last one in a series to finally unblock camera texture capture.

The SurfaceTexture.updateTexImage() calls are moved from the video renderers into MediaCodecVideoDecoder, and the destructor of the texture frames will signal MediaCodecVideoDecoder that the frame has returned. This CL also removes the SurfaceTexture from the native handle and only exposes the texture matrix instead, because only the video source should access the SurfaceTexture.

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

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

Cr-Commit-Position: refs/heads/master@{#10203}
2015-10-07 20:57:17 +00:00
0c4e06b4c6 Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.

BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 10:23:32 +00:00
4139c0f1c5 Java binding for RtpSender/RtpReceiver.
The Java PeerConnection maintains a cached list of Java RtpSenders
and RtpReceivers so that the same objects are returned every time
getSenders() or getReceivers() is called. They are disposed of when
PeerConnection.dispose() is called, which will also dispose their
referenced MediaStreamTracks.

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

Cr-Commit-Position: refs/heads/master@{#10189}
2015-10-06 19:29:32 +00:00
09f1350efa Add option to reset Android video renderer first frame flag.
This allows to correctly report first frame event in applications which
use same remote video renderer for multiple calls.

R=wzh@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10176}
2015-10-05 20:01:41 +00:00
1b33da1298 SurfaceTextureHelper fixes
Fixed a problem where eglBase.makecurrent() could be called after the context had been released if SurfaceTextureHelper was first created and immedately disconnected.

Add the possibility to inject a thread to use instead of creating a new.

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

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

Cr-Commit-Position: refs/heads/master@{#10174}
2015-10-05 19:06:48 +00:00
418503275c Add ThreadChecker class to ThreadUtils
This class can be used for checking that method calls are made on the correct thread.

R=magjed@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10173}
2015-10-05 18:49:15 +00:00
e0bce24065 VideoCapturerAndroid: Add custom nativeCreateVideoCapturer()
This CL shouldn't make any functional changes. It adds a new VideoCapturerAndroid.nativeCreateVideoCapturer() instead of always using VideoCapturer.nativeCreateVideoCapturer(). The purpose is to simplify androidvideocapturer_jni and VideoCapturerAndroid.create(). This way, it is possible to use the ctor instead of VideoCapturerAndroid.init() to initialize variables, and they can be made final etc.

R=perkj@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10171}
2015-10-05 14:22:06 +00:00
bc0938e8e7 Android VideoRendererGui: Make deep copy of incoming texture frames
VideoRendererGui may need to render incoming frames multiple times. We currently call VideoRenderer.renderFrameDone() while we still hold references to the OES texture. This CL makes a deep copy of the OES texture before calling renderFrameDone(). This will truly release the dependency to the incoming frame, so that video textures sources can rely on the renderFrameDone() callback.

This CL is a part of the plan in https://codereview.webrtc.org/1357923002/.

The texture copy doesn't cause any measurable performance difference on a Nexus 5 using VideoRendererGui in a AppRTCDemo loopback call.

BUG=webrtc:4993
TEST=Revert "Enable SurfaceViewRenderer for AppRTCDemo" https://codereview.webrtc.org/1356603004/ and try AppRTCDemo.
R=perkj@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10157}
2015-10-03 15:30:12 +00:00
44bf6f5f67 Android MediaCodecVideoDecoder: Split DecoderOutputBufferInfo into DecodedByteBuffer and DecodedTextureBuffer
This CL separates the types and code paths for textures vs byte buffers in MediaCodecVideoDecoder.dequeueOutputBuffer() and MediaCodecVideoDecoder::DeliverPendingOutputs(). The purpose is to prepare for lifetime management of textures received from the SurfaceTexture.

This CL is a part of the plan in https://codereview.webrtc.org/1357923002/.

BUG=webrtc:4993

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

Cr-Commit-Position: refs/heads/master@{#10156}
2015-10-03 09:08:06 +00:00
7e319372ab Android MediaCodecVideoDecoder: Cleanup to prepare for texture liftime management
This CL should not change the behaviour of the decoder. The purpose is to prepare for lifetime management of textures received from the SurfaceTexture. The main change is to only use exceptions for error signaling in MediaCodecVideoDecoder.dequeueOutputBuffer() and MediaCodecVideoDecoder.releaseOutputBuffer(), not both exceptions and error return values.

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

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

Cr-Commit-Position: refs/heads/master@{#10148}
2015-10-02 13:49:48 +00:00
6781ea49a8 jni/native_handle_impl.h: Move implementation into .cc file
BUG=webrtc:4993
R=hbos@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10147}
2015-10-02 11:56:13 +00:00
0ecf1b2f21 Android focus problem on rear camera.
On some devices (confirmed Samsung) the focus mode is not configured correctly by default.
The fix explicitly set the focus mode to FOCUS_MODE_CONTINUOUS_VIDEO if this mode is supported.

BUG=webrtc:4991

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

Cr-Commit-Position: refs/heads/master@{#10128}
2015-10-01 07:25:53 +00:00
27551c9574 Android RendererCommon: Refactor getSamplingMatrix()
This CL refactors RendererCommon.getSamplingMatrix() so it does not have any dependecy to SurfaceTeture. The purpose is to prepare for a change in how texture frames are represented - only the texture matrix will be exposed, not the SurfaceTexture itself. This CL also adds an extra test for RendererCommon.rotateTextureMatrix().

R=hbos@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10118}
2015-09-30 16:25:22 +00:00
bbda54e6fa Android MediaDecoder: Use frame pool to avoid allocations for non-surface decoding
BUG=webrtc:4993

TEST=To test non-surface path, set 'use_surface_ = false' in androidmediadecoder_jni.cc.
R=perkj@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10116}
2015-09-30 14:06:56 +00:00
a67696b3cd Reland of Adding PeerConnectionInterface::SetConfiguration method. (patchset #1 id:1 of https://codereview.webrtc.org/1361263002/ )
Reason for revert:
Relanding with SetConfiguration not pure virtual.

Original issue's description:
> Revert of Adding PeerConnectionInterface::SetConfiguration method. (patchset #4 id:60001 of https://codereview.webrtc.org/1317353005/ )
>
> Reason for revert:
> Broke FYI bots because SetConfiguration is pure virtual and MockPeerConnectionImpl doesn't implement it. Need to reland with SetConfiguration not pure virtual.
>
> Original issue's description:
> > Adding PeerConnectionInterface::SetConfiguration method.
> >
> > Also updated the JNI and Objective-C bindings. Later, will have a CL to
> > remove UpdateIce, which this method effectively replaces.
> >
> > BUG=webrtc:4945
> >
> > Committed: https://crrev.com/70702afbcb8418fe93747e7ed63bcbf5e56b90e9
> > Cr-Commit-Position: refs/heads/master@{#10040}
>
> TBR=guoweis@webrtc.org,pthatcher@webrtc.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4945
>
> Committed: https://crrev.com/7603c76ab077b1e2033bb179595129bd96797345
> Cr-Commit-Position: refs/heads/master@{#10041}

TBR=guoweis@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4945

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

Cr-Commit-Position: refs/heads/master@{#10112}
2015-09-29 18:56:30 +00:00
1d640e53bd JavaVideoRendererWrapper: Use jlongFromPointer() to convert frame pointer to jlong
The purpose of this CL is to use jlongFromPointer() for converting frame pointers to jlong instead of implicit casts which is not safe.

In order to respect constness, I had to make a small helper function for this.

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

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

Cr-Commit-Position: refs/heads/master@{#10108}
2015-09-29 14:33:27 +00:00
b5815c8013 Revert of Android VideoCapturer: Send ByteBuffer instead of byte[] (patchset #1 id:1 of https://codereview.webrtc.org/1372813002/ )
Reason for revert:
The top row in the video stream from the camera is messed up. The byte[] pointer is not the same as GetDirectBufferAddress() apparently.

Original issue's description:
> Android VideoCapturer: Send ByteBuffer instead of byte[]
>
> The purpose with this CL is to replace GetByteArrayElements() and ReleaseByteArrayElements() with GetDirectBufferAddress().
>
> R=hbos@webrtc.org
>
> Committed: https://crrev.com/cb3649b40b3fd6d5bbb0a92003b717e46ce90924
> Cr-Commit-Position: refs/heads/master@{#10091}

TBR=hbos@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#10103}
2015-09-29 08:13:47 +00:00
4fa648be68 Adding 20-second timeout to Java and Objective-C tests.
This is the same sort of thing we do in C++ end-to-end PeerConnection
tests.

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

Cr-Commit-Position: refs/heads/master@{#10098}
2015-09-28 21:09:00 +00:00
1f429e3418 Passing the new policy from PeerConnection RTCConfiguration to
p2ptransportchannel.  This CL does not use the new policy yet.
BUG=

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

Cr-Commit-Position: refs/heads/master@{#10092}
2015-09-28 14:57:39 +00:00
cb3649b40b Android VideoCapturer: Send ByteBuffer instead of byte[]
The purpose with this CL is to replace GetByteArrayElements() and ReleaseByteArrayElements() with GetDirectBufferAddress().

R=hbos@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10091}
2015-09-28 14:42:12 +00:00
Per
d2413e514a Fix the C++ SurfaceTextureHolder
This cl moves back loading java SurfaceTextureHolder to the ClassReferenceHolder and use FindClass through ClassReferenceHolder. Without this, jni->FindClass returns nullptr in surfacetexturehelper_jni.cc.

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

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

Cr-Commit-Position: refs/heads/master@{#10086}
2015-09-28 09:48:23 +00:00
1ab271c1c4 Android SurfaceTextureHelper: Don't wait for pending frames in disconnect()
This CL also makes some small non-functional changes in ThreadUtils and EglBase to support SurfaceTextures and SurfaceTextureHelper.

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

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

Cr-Commit-Position: refs/heads/master@{#10085}
2015-09-28 09:06:33 +00:00
Per
3e9eb4ba01 Add C++ SurfaceTextureHandler
This cl adds a C++ counterpart of the Java SurfaceTextureHandler. It can be used for creating a webrtc::VideoFrames from a native handle and also guarantee that the Java SurfaceTexture is notified when the VideoFrame is no longer in use.

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

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

Cr-Commit-Position: refs/heads/master@{#10084}
2015-09-28 08:52:36 +00:00
1741770742 Implement a high-QP threshold for Android H.264.
Android hardware H.264 seems to keep a steady high-QP flow instead of
dropping frames, so framedrops aren't sufficient to detect a bad state
where downscaling would be beneficial.

BUG=webrtc:4968
R=magjed@webrtc.org, stefan@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10078}
2015-09-25 15:03:37 +00:00
2bc68c731d Wire up QualityScaler for H.264 on Android.
BUG=webrtc:4968
R=magjed@webrtc.org, stefan@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10055}
2015-09-24 14:22:37 +00:00
7603c76ab0 Revert of Adding PeerConnectionInterface::SetConfiguration method. (patchset #4 id:60001 of https://codereview.webrtc.org/1317353005/ )
Reason for revert:
Broke FYI bots because SetConfiguration is pure virtual and MockPeerConnectionImpl doesn't implement it. Need to reland with SetConfiguration not pure virtual.

Original issue's description:
> Adding PeerConnectionInterface::SetConfiguration method.
>
> Also updated the JNI and Objective-C bindings. Later, will have a CL to
> remove UpdateIce, which this method effectively replaces.
>
> BUG=webrtc:4945
>
> Committed: https://crrev.com/70702afbcb8418fe93747e7ed63bcbf5e56b90e9
> Cr-Commit-Position: refs/heads/master@{#10040}

TBR=guoweis@webrtc.org,pthatcher@webrtc.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4945

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

Cr-Commit-Position: refs/heads/master@{#10041}
2015-09-24 00:37:20 +00:00
70702afbcb Adding PeerConnectionInterface::SetConfiguration method.
Also updated the JNI and Objective-C bindings. Later, will have a CL to
remove UpdateIce, which this method effectively replaces.

BUG=webrtc:4945

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

Cr-Commit-Position: refs/heads/master@{#10040}
2015-09-23 23:32:38 +00:00
f706c8ae91 VideoCapturerAndroid: Fix threading issues
This CL makes the following changes:
 * Instead of creating a new thread per startCapture()/stopCapture() cycle, VideoCapturerAndroid has a single thread that is initialized in the constructor and kept during the lifetime of the instance. This is more convenient because then it is always possible to post runnables without if-checks. This way, a lot of synchronize statements can be removed. Also, when the camera thread is preserved after stopCapture() it is possible to post late returnBuffer() calls to the correct thread.
 * FramePool now enforces single thread use and returnBuffer() calls are posted to the camera thread. This is important because the camera should only be used from one thread, and we call camera.addCallbackBuffer() in returnBuffer().
 * switchCamera() no longer returns false on failure, but instead signals the result via the callback.
 * Update the test testCaptureAndAsyncRender() - it's not a valid use case to have outstanding frames when calling PeerConnectionFactory.dispose(). Instead, the renderer implementations should have release() functions that block until all frames are returned. The release() functions need to be called in the correct order with PeerConnectionFactory.dispose() last.

BUG=webrtc:4909
R=hbos@webrtc.org, perkj@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10025}
2015-09-23 10:01:40 +00:00
8212265053 Android: Add class ThreadUtils with helper function joinUninterruptibly()
R=hbos@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10016}
2015-09-22 13:17:23 +00:00