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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}