179 Commits

Author SHA1 Message Date
Sami Kalliomaki
9b0dc622d4 Revert of Combine webrtc/api/java/android and webrtc/api/java/src. (patchset #1 id:1 of https://codereview.webrtc.org/2111823002/ )
Reason for revert:
Breaks downstream dependencies

Original issue's description:
> Combine webrtc/api/java/android and webrtc/api/java/src.
>
> It used to be that there was a Java api for devices not running Android
> but that is no longer the case. I combined the directories and made
> the folder structure chromium style.
>
> BUG=webrtc:6067
> R=magjed@webrtc.org, tommi@webrtc.org
>
> Committed: ceefe20dd6

TBR=magjed@webrtc.org,tommi@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:6067

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

Cr-Commit-Position: refs/heads/master@{#13357}
2016-07-01 07:37:49 +00:00
Sami Kalliomaki
ceefe20dd6 Combine webrtc/api/java/android and webrtc/api/java/src.
It used to be that there was a Java api for devices not running Android
but that is no longer the case. I combined the directories and made
the folder structure chromium style.

BUG=webrtc:6067
R=magjed@webrtc.org, tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13356}
2016-07-01 07:09:09 +00:00
Honghai Zhang
e59122889f This helps recognize more network types
and even if the "unknown" network type is not helpful for identifying the network type, it helps bind sockets to the network.

BUG=
R=glaznev@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13351}
2016-06-30 20:00:03 +00:00
Peter Boström
c5ad0c81c7 Respect VP8.automaticResizeOn for MediaCodec.
Disables QualityScaler for screenshare-type content and simulcast inside
MediaCodecVideoEncoder.

BUG=
R=glaznev@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13347}
2016-06-30 14:11:43 +00:00
ivoc
9e03c3b372 Revert of Move RtcEventLog object from inside VoiceEngine to Call. (patchset #16 id:420001 of https://codereview.webrtc.org/1748403002/ )
Reason for revert:
Reverting all CLs related to moving the eventlog, as they break Chromium tests.

Original issue's description:
> Move RtcEventLog object from inside VoiceEngine to Call.
>
> In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced.
> The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface.
>
> BUG=webrtc:4741,webrtc:5603,chromium:609749
> R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org
>
> Committed: https://crrev.com/1895526c6130e3d0e9b154f95079b8eda7567016
> Cr-Commit-Position: refs/heads/master@{#13321}

TBR=solenberg@webrtc.org,tommi@webrtc.org,stefan@webrtc.org,terelius@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4741,webrtc:5603,chromium:609749

Review-Url: https://codereview.webrtc.org/2111813002
Cr-Commit-Position: refs/heads/master@{#13340}
2016-06-30 07:59:49 +00:00
skvlad
4c4cb5b984 Separate the JNI function that controls logging levels into two.
The parameters for Logging.enableTracing() were creating the impression
that they control level and severity of one tracing system and they are
meant to be used together. In fact the "levels" parameter controlled one
tracing system (WEBRTC_TRACE), and the "severity" parameter was
responsible for a completely different one: setting the severity level
above which log messages from LOG() will be directed to the
platform-specific debug output (logcat on Android).

The method signature suggested that the "path" parameter applied to both
systems - while it was only meaningful for the WEBRTC_TRACE; LOG
messages were directed to ADB logcat no matter what the Path value was.
It is possible to redirect LOG messages to a file, but that is done
using a completely different set of APIs
 - PeerConnectionFactory.startInternalTracingCapture().

I've separated these two methods to make it more clear which of the
parameters controls which system.

NOTRY=true

Review-Url: https://codereview.webrtc.org/2110853003
Cr-Commit-Position: refs/heads/master@{#13334}
2016-06-29 22:30:48 +00:00
Ivo Creusen
1895526c61 Move RtcEventLog object from inside VoiceEngine to Call.
In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced.
The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface.

BUG=webrtc:4741,webrtc:5603,chromium:609749
R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13321}
2016-06-29 11:57:01 +00:00
Sami Kalliomaki
8cf2a3a3ad Android: Camera2 implementation and tests for it.
BUG=webrtc:5519
R=magjed@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13320}
2016-06-29 11:27:50 +00:00
Magnus Jedvert
f4878e5968 VideoCapturerAndroid: Remove unused function getCameraThreadHandler
R=sakal@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13319}
2016-06-29 09:43:13 +00:00
Sami Kalliomaki
9c7a0dbc8a Constructor in Camera1Enumerator should be public.
R=danilchap@webrtc.org
TBR=magjed_webrtc

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

Cr-Commit-Position: refs/heads/master@{#13315}
2016-06-28 17:04:06 +00:00
sakal
70fae2ccc6 Add override annotation to appropriate methods in Camera1Enumerator.
Also move getDeviceNames to a more appropriate location in the file.

NOTRY=True

Review-Url: https://codereview.webrtc.org/2105813002
Cr-Commit-Position: refs/heads/master@{#13312}
2016-06-28 15:36:43 +00:00
Alex Glaznev
d57048433c Decrease the amount of maximum outstanding frames for Android HW H.264 decoder.
BUG=b/28150902
R=pbos@webrtc.org, sakal@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13302}
2016-06-27 18:51:24 +00:00
Sami Kalliomaki
b52e81c054 Allow disabling capture to texture on Camera1Enumerator using constructor parameter.
The plan is that the CameraEnumerationAndroid will in the future have
method called getEnumerator that will return an enumerator that can be
used to create CameraVideoCapturer objects. It will return
Camera2Enumerator if it is supported or else Camera1Enumerator. Some
apps want to capture to byte buffers which is no longer supported in the
camera2 version of CameraVideoCapturer. Camera1Enumerator constructed
with false parameter as captureToTexture will be returned to these apps.

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

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

Cr-Commit-Position: refs/heads/master@{#13294}
2016-06-27 13:10:23 +00:00
nisse
191b359d0d Implement timestamp translation/filter in VideoCapturer.
Use in AndroidVideoCapturer.

BUG=webrtc:5740

Review-Url: https://codereview.webrtc.org/2017443003
Cr-Commit-Position: refs/heads/master@{#13254}
2016-06-22 15:36:58 +00:00
honghaiz
123f33cd00 Revert of Delete method cricket::VideoFrame::Copy. (patchset #7 id:120001 of https://codereview.webrtc.org/2080253002/ )
Reason for revert:
It broke a downstream build by removing VideoFrame::Copy method.

Original issue's description:
> Delete method cricket::VideoFrame::Copy.
>
> Should be unused in Chrome since cl
> https://codereview.chromium.org/2068703002/
>
> TBR=tkchin@webrtc.org,magjed@webrtc.org
> BUG=webrtc:5682
>
> Committed: https://crrev.com/9c00f646f0b3cd33506a1944c7bc6724af041237
> Committed: https://crrev.com/7e4e00d189a5dfac2b463a5100ee65ee2f11ed79
> Cr-Original-Commit-Position: refs/heads/master@{#13236}
> Cr-Commit-Position: refs/heads/master@{#13244}

TBR=pbos@webrtc.org,tkchin@webrtc.org,magjed@webrtc.org,sergeyu@chromium.org,nisse@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5682

Review-Url: https://codereview.webrtc.org/2087923004
Cr-Commit-Position: refs/heads/master@{#13246}
2016-06-21 21:03:01 +00:00
nisse
7e4e00d189 Delete method cricket::VideoFrame::Copy.
Should be unused in Chrome since cl
https://codereview.chromium.org/2068703002/

TBR=tkchin@webrtc.org,magjed@webrtc.org
BUG=webrtc:5682

Committed: https://crrev.com/9c00f646f0b3cd33506a1944c7bc6724af041237
Review-Url: https://codereview.webrtc.org/2080253002
Cr-Original-Commit-Position: refs/heads/master@{#13236}
Cr-Commit-Position: refs/heads/master@{#13244}
2016-06-21 19:53:56 +00:00
nisse
3a2a6404b1 Revert of Delete method cricket::VideoFrame::Copy. (patchset #7 id:120001 of https://codereview.webrtc.org/2080253002/ )
Reason for revert:
Breaks chrome, because a new use of Copy was added in cl https://codereview.chromium.org/2062843003

Original issue's description:
> Delete method cricket::VideoFrame::Copy.
>
> Should be unused in Chrome since cl
> https://codereview.chromium.org/2068703002/
>
> TBR=tkchin@webrtc.org,magjed@webrtc.org
> BUG=webrtc:5682
>
> Committed: https://crrev.com/9c00f646f0b3cd33506a1944c7bc6724af041237
> Cr-Commit-Position: refs/heads/master@{#13236}

TBR=pbos@webrtc.org,tkchin@webrtc.org,magjed@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5682

Review-Url: https://codereview.webrtc.org/2082643004
Cr-Commit-Position: refs/heads/master@{#13238}
2016-06-21 11:17:36 +00:00
nisse
9c00f646f0 Delete method cricket::VideoFrame::Copy.
Should be unused in Chrome since cl
https://codereview.chromium.org/2068703002/

TBR=tkchin@webrtc.org,magjed@webrtc.org
BUG=webrtc:5682

Review-Url: https://codereview.webrtc.org/2080253002
Cr-Commit-Position: refs/heads/master@{#13236}
2016-06-21 11:04:30 +00:00
glaznev
ce5a874674 Improve encoding time calculation for Android HW encoder.
BUG=b/29359403

Review-Url: https://codereview.webrtc.org/2066373002
Cr-Commit-Position: refs/heads/master@{#13202}
2016-06-19 02:13:04 +00:00
nisse
ca6d5d1c9f Partial reland of Delete unused and almost unused frame-related methods. (patchset #1 id:1 of https://codereview.webrtc.org/2076113002/ )
Reason for revert:
Taking out the VideoFrameBuffer changes which broke downstream.

Original issue's description:
> Revert of Delete unused and almost unused frame-related methods. (patchset #12 id:220001 of https://codereview.webrtc.org/2065733003/ )
>
> Reason for revert:
> Breaks downstream applications which inherits webrtc::VideoFrameBuffer and tries to override deleted methods data(), stride() and MutableData().
>
> Original issue's description:
> > Delete unused and almost unused frame-related methods.
> >
> > webrtc::VideoFrame::set_video_frame_buffer
> > webrtc::VideoFrame::ConvertNativeToI420Frame
> >
> > cricket::WebRtcVideoFrame::InitToBlack
> >
> > VideoFrameBuffer::data
> > VideoFrameBuffer::stride
> > VideoFrameBuffer::MutableData
> >
> > TBR=tkchin@webrtc.org # Refactoring affecting RTCVideoFrame
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/76270de4bc2dac188f10f805e6e2fb86693ef864
> > Cr-Commit-Position: refs/heads/master@{#13183}
>
> TBR=perkj@webrtc.org,pbos@webrtc.org,marpan@webrtc.org,tkchin@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/72e735d3867a0fd6ab7e4d0761c7ba5f6c068617
> Cr-Commit-Position: refs/heads/master@{#13184}

TBR=perkj@webrtc.org,pbos@webrtc.org,marpan@webrtc.org,tkchin@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5682

Review-Url: https://codereview.webrtc.org/2076123002
Cr-Commit-Position: refs/heads/master@{#13189}
2016-06-17 12:03:09 +00:00
sakal
62379c89d0 Move Camera1 specific methods to Camera1Enumerator and create CameraEnumerator interface.
The plan is to use CameraEnumerator as a "factory" for camera objects in
the future. This CL prepares for that by moving Camera1 specific stuff
away from CameraEnumerationAndroid to Camera1Enumerator. Because
CameraEnumerationAndroid methods were part of public API there are
deprecated mocks for now.

When making these changes, I noticed that code duplication in
CameraVideoCapturer tests implementing TestObjectFactory could be
decreased by making TestObjectFactory an abstract class that uses
CameraEnumerator.

BUG=webrtc:5519

Review-Url: https://codereview.webrtc.org/2071803002
Cr-Commit-Position: refs/heads/master@{#13185}
2016-06-17 10:45:53 +00:00
nisse
72e735d386 Revert of Delete unused and almost unused frame-related methods. (patchset #12 id:220001 of https://codereview.webrtc.org/2065733003/ )
Reason for revert:
Breaks downstream applications which inherits webrtc::VideoFrameBuffer and tries to override deleted methods data(), stride() and MutableData().

Original issue's description:
> Delete unused and almost unused frame-related methods.
>
> webrtc::VideoFrame::set_video_frame_buffer
> webrtc::VideoFrame::ConvertNativeToI420Frame
>
> cricket::WebRtcVideoFrame::InitToBlack
>
> VideoFrameBuffer::data
> VideoFrameBuffer::stride
> VideoFrameBuffer::MutableData
>
> TBR=tkchin@webrtc.org # Refactoring affecting RTCVideoFrame
> BUG=webrtc:5682
>
> Committed: https://crrev.com/76270de4bc2dac188f10f805e6e2fb86693ef864
> Cr-Commit-Position: refs/heads/master@{#13183}

TBR=perkj@webrtc.org,pbos@webrtc.org,marpan@webrtc.org,tkchin@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5682

Review-Url: https://codereview.webrtc.org/2076113002
Cr-Commit-Position: refs/heads/master@{#13184}
2016-06-17 09:55:23 +00:00
nisse
76270de4bc Delete unused and almost unused frame-related methods.
webrtc::VideoFrame::set_video_frame_buffer
webrtc::VideoFrame::ConvertNativeToI420Frame

cricket::WebRtcVideoFrame::InitToBlack

VideoFrameBuffer::data
VideoFrameBuffer::stride
VideoFrameBuffer::MutableData

TBR=tkchin@webrtc.org # Refactoring affecting RTCVideoFrame
BUG=webrtc:5682

Review-Url: https://codereview.webrtc.org/2065733003
Cr-Commit-Position: refs/heads/master@{#13183}
2016-06-17 09:00:19 +00:00
sakal
e6c9e88c18 Android: Add Size class.
The Camera1 and Camera2 API use different size types. Camera1 uses
android.hardware.Camera.Size while Camera2 uses android.util.Size.
android.util.Size is only available from Lollipop forward so this CL
adds a similar Size class in CaptureFormat.

The purpose of this CL is to have a common size type that can be reused
from both Camera1 and Camera2 helper functions such as
CameraEnumerationAndroid.getClosestSupportedSize().

BUG=webrtc:5519

Review-Url: https://codereview.webrtc.org/2066773002
Cr-Commit-Position: refs/heads/master@{#13181}
2016-06-17 08:02:10 +00:00
skvlad
3abb764400 Avoid unnecessary HW video encoder reconfiguration
This change reduces the number of times the Android hardware video
encoder is reconfigured when making an outgoing call. With this change,
the encoder should only be initialized once as opposed to the ~3 times
it happens currently.

Before the fix, the following sequence of events caused the extra
reconfigurations:

 1. After the SetLocalDescription call, the WebRtcVideoSendStream is created.
    All frames from the camera are dropped until the corresponding
    VideoSendStream is created.

 2. SetRemoteDescription() triggers the VideoSendStream creation. At
    this point, the encoder is configured for the first time, with the
    frame dimensions set to a low resolution default (176x144).

 3. When the first video frame is received from the camera after the
    VideoSendStreamIsCreated, the encoder is reconfigured to the correct
    dimensions. If we are using the Android hardware encoder, the default
    configuration is set to encode from a memory buffer (use_surface=false).

 4. When the frame is passed down to the encoder in
    androidmediaencoder_jni.cc EncodeOnCodecThread(), it may be stored in
    a texture instead of a memory buffer. In this case, yet another
    reconfiguration takes place to enable encoding from a texture.

 5. Even if the resolution and texture flag were known at the start of
    the call, there would be a reconfiguration involved if the camera is
    rotated (such as when making a call from a phone in portrait orientation).
    The reason for that is that at construction time, WebRtcVideoEngine2
    sets the VideoSinkWants structure parameter to request frames rotated
    by the source; the early frames will then arrive in portrait resolution.
    When the remote description is finally set, if the rotation RTP extension
    is supported by the remote receiver, the source is asked to provide
    non-rotated frames. The very next frame will then arrive in landscape
    resolution with a non-zero rotation value to be applied by the receiver.
    Since the encoder was configured with the last (portrait) frame size,
    it's going to need to be reconfigured again.

The fix makes the following changes:

 1. WebRtcVideoSendStream::OnFrame() now caches the last seen frame
    dimensions, and whether the frame was stored in a texture.

 2. When the encoder is configured the first time
    (WebRtcVideoSendStream::SetCodec()) - the last seen frame dimensions
    are used instead of the default dimensions.

 3. A flag that indicates if encoding is to be done from a texture has
    been added to the webrtc::VideoStream and webrtc::VideoCodec structs,
    and it's been wired up to be passed down all the way to the JNI code in
    androidmediaencoder_jni.cc.

 4. MediaCodecVideoEncoder::InitEncode is now reading the is_surface
    flag from the VideoCodec structure instead of guessing the default as
    false. This way we end up with the correct encoder configuration the
    first time around.

 5. WebRtcVideoSendStream now takes an optimistic guess and requests non-
    rotated frames when the supported RtpExtensions list is not available.
    This makes the "early" frames arrive non-rotated, and the cached dimensions
    will be correct for the common case when the rotation extension is supported.
    If the other side is an older endpoint which does not support rotation,
    the encoder will have to be reconfigured - but it's better to penalize the
    uncommon case rather than the common one.

Review-Url: https://codereview.webrtc.org/2067103002
Cr-Commit-Position: refs/heads/master@{#13173}
2016-06-16 19:08:11 +00:00
Sami Kalliomaki
5a9e7e0ba0 Fix a few error prone lines on VideoCapturerAndroid.
R=pbos@webrtc.org, perkj@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13164}
2016-06-16 12:26:03 +00:00
sakal
79ede033f6 Refactor VideoCapturerAndroid tests in WebRTC.
Camera1 tests are now separated from general CameraVideoCapturer tests.
Main motivation behind these changes is that Camera2 implementation can
be tested using the same tests.

CL also reduces code duplication on tests using textures.

BUG=webrtc:5519

Review-Url: https://codereview.webrtc.org/2024843002
Cr-Commit-Position: refs/heads/master@{#13130}
2016-06-14 12:33:48 +00:00
sakal
1fc4810006 Always on statistics for AndroidMediaEncoder.
Earlier, no statistics were reported if no frames were being delivered
for encoding. This makes statics always be reported regardless of if
there are frames being delivered to the encoder.

Review-Url: https://codereview.webrtc.org/2051403002
Cr-Commit-Position: refs/heads/master@{#13122}
2016-06-14 08:53:44 +00:00
Niels Möller
718a763d59 Refactor scaling.
Introduce a new method I420Buffer::CropAndScale, and a static
convenience helper I420Buffer::CenterCropAndScale. Use them for almost
all scaling needs.

Delete the Scaler class and the cricket::VideoFrame::Stretch* methods.

BUG=webrtc:5682
R=pbos@webrtc.org, perkj@webrtc.org, stefan@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13110}
2016-06-13 11:06:14 +00:00
Taylor Brandstetter
5d97a9a05b Adding more detail to MessageQueue::Dispatch logging.
Every message will now be traced with the location from which it was
posted, including function name, file and line number.

This CL also writes a normal LOG message when the dispatch took more
than a certain amount of time (currently 50ms).

This logging should help us identify messages that are taking
longer than expected to be dispatched.

R=pthatcher@webrtc.org, tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13104}
2016-06-10 21:17:33 +00:00
Niels Möller
86f7afd44f Android: Fix texture leak.
The bug fix in https://codereview.webrtc.org/2033943004 was
incomplete, and leaks the texture in the case of texture frames
arriving during close. See also the similar bug fixed in
https://codereview.webrtc.org/2012773004.

BUG=webrtc:5966
R=perkj@webrtc.org, sakal@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13067}
2016-06-08 12:59:14 +00:00
Per
47183ba60b Handle Android stop capturer race.
With the current order of stop capture processing on Android,
OnMemoryBufferFrame and OnTextureFrame may be called halfway through
Stop(). They must therefore check for the case of a null capturer_.

There used to be such checks, but they were accidantally removed in
commit #12895, cl https://codereview.webrtc.org/1973873003.

BUG=webrtc:5966
R=perkj@webrtc.org, sakal@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#13031}
2016-06-03 11:05:34 +00:00
magjed
453018a29e CameraEnumerationAndroid: Remove Enumerator class
BUG=webrtc:5519

Review-Url: https://codereview.webrtc.org/2015143004
Cr-Commit-Position: refs/heads/master@{#12999}
2016-06-01 21:39:43 +00:00
deadbeef
0fe8548303 Fixing overloaded-virtual compiler warning.
NOTRY=True
TBR=glaznev@webrtc.org

Review-Url: https://codereview.webrtc.org/2023413002
Cr-Commit-Position: refs/heads/master@{#12998}
2016-06-01 20:42:36 +00:00
Magnus Jedvert
2e646c8729 VideoCapturerAndroid: Check that camera is still running in every *OnCameraThread method
removeCallbacksAndMessages() is called on the camera thread handler
before setting it to null to remove all pending runnables. The purpose
is to make sure *OnCameraThread methods are not executed when the
camera is stopped, but this does not seem to work reliably. This CL
resorts to a belt and braces approach and checks that the the handler is
still alive in all *OnCameraThread methods.

BUG=b/29015569
R=sakal@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#12981}
2016-06-01 07:45:32 +00:00
magjed
ce17e01bf6 Reland of Android: Change camera fps range selection (patchset #1 id:1 of https://codereview.webrtc.org/2021233002/ )
Reason for revert:
Fixed gyp bug.

Original issue's description:
> Revert of Android: Change camera fps range selection (patchset #4 id:100001 of https://codereview.webrtc.org/2013413002/ )
>
> Reason for revert:
> Breaks chromium fyi:
> https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/13565
> on step 'generate_build_files':
> gyp: /b/build/slave/Mac_Builder/build/src/third_party/build/android/test_runner.gypi not found
>
> Original issue's description:
> > Android: Change camera fps range selection
> >
> > This CL changes the logic in
> > CameraEnumerationAndroid.getClosestSupportedFramerateRange() to prefer
> > fps ranges with a low lower bound so the camera can adjust for
> > brightness conditions.
> >
> > To test the functionality of the fps range selection, JUnit tests are
> > added. This required a new target in api_tests.gyp. JUnit tests are
> > preferable over instrumentation tests
> > (libjingle_peerconnection_android_unittest) because they are faster and
> > simpler.
> >
> > R=kjellander@webrtc.org, sakal@webrtc.org
> >
> > Committed: https://crrev.com/b4ddb5c3d3706b1c02437f6a538576f3552ab908
> > Cr-Commit-Position: refs/heads/master@{#12964}
>
> TBR=sakal@webrtc.org,kjellander@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
>
> Committed: https://crrev.com/b3f208d0ba45f140272e3e705b5cdadc3c76514b
> Cr-Commit-Position: refs/heads/master@{#12966}

TBR=sakal@webrtc.org,kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.webrtc.org/2028583002
Cr-Commit-Position: refs/heads/master@{#12980}
2016-06-01 07:44:07 +00:00
honghaiz
603470576e Add a flag to filter out high-cost networks.
This allows webrtc to not gather on cellular networks if wifi or
other low cost networks are present.
BUG=

Review-Url: https://codereview.webrtc.org/1987833002
Cr-Commit-Position: refs/heads/master@{#12979}
2016-06-01 01:29:18 +00:00
Taylor Brandstetter
98cde26c78 Use scoped_refptr for On(Add|Remove)Stream and OnDataChannel.
This will make it much less likely for application developers to not
realize the object is reference counted.

It also fixes a bug in the Java PeerConnection binding, by allowing a
reference to be transferred in the OnRemoveStream call via std::move.

BUG=webrtc:5128
R=pthatcher@webrtc.org, tkchin@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#12976}
2016-05-31 20:02:30 +00:00
magjed
b3f208d0ba Revert of Android: Change camera fps range selection (patchset #4 id:100001 of https://codereview.webrtc.org/2013413002/ )
Reason for revert:
Breaks chromium fyi:
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/13565
on step 'generate_build_files':
gyp: /b/build/slave/Mac_Builder/build/src/third_party/build/android/test_runner.gypi not found

Original issue's description:
> Android: Change camera fps range selection
>
> This CL changes the logic in
> CameraEnumerationAndroid.getClosestSupportedFramerateRange() to prefer
> fps ranges with a low lower bound so the camera can adjust for
> brightness conditions.
>
> To test the functionality of the fps range selection, JUnit tests are
> added. This required a new target in api_tests.gyp. JUnit tests are
> preferable over instrumentation tests
> (libjingle_peerconnection_android_unittest) because they are faster and
> simpler.
>
> R=kjellander@webrtc.org, sakal@webrtc.org
>
> Committed: https://crrev.com/b4ddb5c3d3706b1c02437f6a538576f3552ab908
> Cr-Commit-Position: refs/heads/master@{#12964}

TBR=sakal@webrtc.org,kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.webrtc.org/2021233002
Cr-Commit-Position: refs/heads/master@{#12966}
2016-05-31 08:44:34 +00:00
Magnus Jedvert
b4ddb5c3d3 Android: Change camera fps range selection
This CL changes the logic in
CameraEnumerationAndroid.getClosestSupportedFramerateRange() to prefer
fps ranges with a low lower bound so the camera can adjust for
brightness conditions.

To test the functionality of the fps range selection, JUnit tests are
added. This required a new target in api_tests.gyp. JUnit tests are
preferable over instrumentation tests
(libjingle_peerconnection_android_unittest) because they are faster and
simpler.

R=kjellander@webrtc.org, sakal@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#12964}
2016-05-31 08:19:02 +00:00
nisse
92379de5c6 Reorder actions on stopCapturer, to avoid crashing on camera timeout.
BUG=

Review-Url: https://codereview.webrtc.org/2003973003
Cr-Commit-Position: refs/heads/master@{#12963}
2016-05-31 06:36:05 +00:00
magjed
e38a93663a Reland of Android: Add FramerateRange class (patchset #1 id:1 of https://codereview.webrtc.org/2024573002/ )
Reason for revert:
Updated signature to work with other JNI versions. We would need to compile it differently in order to catch failures like this in WebRTC in the future.

Original issue's description:
> Revert of Android: Add FramerateRange class (patchset #2 id:60001 of https://codereview.webrtc.org/2010763003/ )
>
> Reason for revert:
> Breaks downstream Android tests:
> java.lang.NoSuchFieldError: no field with name='framerate' signature='org/webrtc/CameraEnumerationAndroid$CaptureFormat$FramerateRange' in class Lorg/webrtc/CameraEnumerationAndroid$CaptureFormat;
>
> We should have a similar test in WebRTC so we can catch such errors pre-commit.
>
> Original issue's description:
> > Android: Add FramerateRange class
> >
> > The Camera1 and Camera2 API use different framerate range types. Camera1
> > uses int[2] and Camera2 uses Range<Integer>. Range<Integer> is
> > unfortunately only available on Lollipop and later, so this CL adds a
> > similar FramerateRange class in CaptureFormat.
> >
> > The purpose with this CL is to have a common framerate range type that can
> > be reused from both Camera1 and Camera2 in helper functions such as
> > CameraEnumerationAndroid.getClosestSupportedFramerateRange().
> >
> > BUG=webrtc:5519
> > R=sakal@webrtc.org
> >
> > Committed: https://crrev.com/94cb67d6df1a78e7fa25e469f719c1a8809dc583
> > Cr-Commit-Position: refs/heads/master@{#12942}
>
> TBR=sakal@webrtc.org,magjed@webrtc.org
> NOTRY=True
> BUG=webrtc:5519
>
> Committed: https://crrev.com/bd5621f065fd25e0a77307f10dc9ddaf76e7945f
> Cr-Commit-Position: refs/heads/master@{#12956}

TBR=sakal@webrtc.org,kjellander@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5519

Review-Url: https://codereview.webrtc.org/2019333002
Cr-Commit-Position: refs/heads/master@{#12957}
2016-05-30 11:00:27 +00:00
kjellander
bd5621f065 Revert of Android: Add FramerateRange class (patchset #2 id:60001 of https://codereview.webrtc.org/2010763003/ )
Reason for revert:
Breaks downstream Android tests:
java.lang.NoSuchFieldError: no field with name='framerate' signature='org/webrtc/CameraEnumerationAndroid$CaptureFormat$FramerateRange' in class Lorg/webrtc/CameraEnumerationAndroid$CaptureFormat;

We should have a similar test in WebRTC so we can catch such errors pre-commit.

Original issue's description:
> Android: Add FramerateRange class
>
> The Camera1 and Camera2 API use different framerate range types. Camera1
> uses int[2] and Camera2 uses Range<Integer>. Range<Integer> is
> unfortunately only available on Lollipop and later, so this CL adds a
> similar FramerateRange class in CaptureFormat.
>
> The purpose with this CL is to have a common framerate range type that can
> be reused from both Camera1 and Camera2 in helper functions such as
> CameraEnumerationAndroid.getClosestSupportedFramerateRange().
>
> BUG=webrtc:5519
> R=sakal@webrtc.org
>
> Committed: https://crrev.com/94cb67d6df1a78e7fa25e469f719c1a8809dc583
> Cr-Commit-Position: refs/heads/master@{#12942}

TBR=sakal@webrtc.org,magjed@webrtc.org
NOTRY=True
BUG=webrtc:5519

Review-Url: https://codereview.webrtc.org/2024573002
Cr-Commit-Position: refs/heads/master@{#12956}
2016-05-30 06:06:31 +00:00
hbos
d7973ccdb5 Revert of Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface. (patchset #2 id:20001 of https://codereview.webrtc.org/2013523002/ )
Reason for revert:
There are more CreatePeerConnection calls than I anticipated/had found in Chromium, like remoting/protocol/webrtc_transport.cc. Reverting due to broken Chromium FYI bots.

Original issue's description:
> Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface.
>
> The store was used in WebRtcSessionDescriptionFactory to generate certificates,
> now a generator is used instead (new API). PeerConnection[Factory][Interface],
> and WebRtcSession are updated to pass generators all the way down to the
> WebRtcSessionDescriptionFactory instead of stores.
>
> The webrtc implementation of a generator, RTCCertificateGenerator, is used as
> the default generator (peerconnectionfactory.cc:189) instead of the webrtc
> implementation of a store, DtlsIdentityStoreImpl.
>   The generator is fully parameterized and does not generate RSA-1024 unless you
> ask for it (which makes sense not to do beforehand since ECDSA is now default).
> The store was not fully parameterized (known filed bug).
>
> The "top" layer, PeerConnectionFactoryInterface::CreatePeerConnection, is
> updated to take a generator instead of a store. But as to not break Chromium,
> the old function signature taking a store is kept. It is implemented to invoke
> the generator version by wrapping the store in an
> RTCCertificateGeneratorStoreWrapper. As soon as Chromium is updated to use the
> new function signature we can remove the old CreatePeerConnection.
>   Due to having multiple CreatePeerConnection signatures, some calling places
> are updated to resolve the ambiguity introduced.
>
> BUG=webrtc:5707, webrtc:5708
> R=phoglund@webrtc.org, tommi@webrtc.org
> TBR=tkchin@webrc.org
>
> Committed: 400781a209

TBR=tkchin@webrtc.org,tommi@webrtc.org,phoglund@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5707, webrtc:5708

Review-Url: https://codereview.webrtc.org/2020633002
Cr-Commit-Position: refs/heads/master@{#12948}
2016-05-27 13:08:58 +00:00
Henrik Boström
400781a209 Replacing DtlsIdentityStoreInterface with RTCCertificateGeneratorInterface.
The store was used in WebRtcSessionDescriptionFactory to generate certificates,
now a generator is used instead (new API). PeerConnection[Factory][Interface],
and WebRtcSession are updated to pass generators all the way down to the
WebRtcSessionDescriptionFactory instead of stores.

The webrtc implementation of a generator, RTCCertificateGenerator, is used as
the default generator (peerconnectionfactory.cc:189) instead of the webrtc
implementation of a store, DtlsIdentityStoreImpl.
  The generator is fully parameterized and does not generate RSA-1024 unless you
ask for it (which makes sense not to do beforehand since ECDSA is now default).
The store was not fully parameterized (known filed bug).

The "top" layer, PeerConnectionFactoryInterface::CreatePeerConnection, is
updated to take a generator instead of a store. But as to not break Chromium,
the old function signature taking a store is kept. It is implemented to invoke
the generator version by wrapping the store in an
RTCCertificateGeneratorStoreWrapper. As soon as Chromium is updated to use the
new function signature we can remove the old CreatePeerConnection.
  Due to having multiple CreatePeerConnection signatures, some calling places
are updated to resolve the ambiguity introduced.

BUG=webrtc:5707, webrtc:5708
R=phoglund@webrtc.org, tommi@webrtc.org
TBR=tkchin@webrc.org

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

Cr-Commit-Position: refs/heads/master@{#12947}
2016-05-27 12:52:06 +00:00
magjed
36c11e9132 VideoCapturerAndroid: Replace static create() with ctor
This CL makes the ctor public and externally usable by changing the
camera id argument from an int to a String.

The main purpose with this change is to get rid of the
CameraEnumerationAndroid.setEnumerator() hack. If an external app wants
to have a custom format enumeration, they can just override
getSupportedFormats() instead.

BUG=webrtc:5519

Review-Url: https://codereview.webrtc.org/2012193003
Cr-Commit-Position: refs/heads/master@{#12945}
2016-05-27 09:35:14 +00:00
Magnus Jedvert
94cb67d6df Android: Add FramerateRange class
The Camera1 and Camera2 API use different framerate range types. Camera1
uses int[2] and Camera2 uses Range<Integer>. Range<Integer> is
unfortunately only available on Lollipop and later, so this CL adds a
similar FramerateRange class in CaptureFormat.

The purpose with this CL is to have a common framerate range type that can
be reused from both Camera1 and Camera2 in helper functions such as
CameraEnumerationAndroid.getClosestSupportedFramerateRange().

BUG=webrtc:5519
R=sakal@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#12942}
2016-05-27 08:36:01 +00:00
nisse
a44e72c44f Call java SurfaceTextureHelper.dispose from the corresponding C++ destructor.
This makes it clearer that the C++ SurfaceTextureHelper owns its associated java object it.

In addition, arrange so that the SurfaceTextureHelper.stopListening
method (in java) can be called from any thread.

BUG=

Review-Url: https://codereview.webrtc.org/1988043002
Cr-Commit-Position: refs/heads/master@{#12941}
2016-05-27 07:28:05 +00:00
magjed
77405b2794 Android: Fix frame dropping for texture frames
A bug was introduced in https://codereview.webrtc.org/1973873003 that
doesn't return texture frames when they are dropped.

BUG=webrtc:5682

Review-Url: https://codereview.webrtc.org/2012773004
Cr-Commit-Position: refs/heads/master@{#12922}
2016-05-26 15:34:45 +00:00
magjed
cd8e2ba29b VideoCapturerAndroid: Remove isDisposed()
Also remove the unnecessary code in VideoCapturerAndroid.dispose() and
only log instead.

BUG=webrtc:5519

Review-Url: https://codereview.webrtc.org/2007863005
Cr-Commit-Position: refs/heads/master@{#12913}
2016-05-26 11:00:55 +00:00