166 Commits

Author SHA1 Message Date
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
Alex Glaznev
269fe75a96 Enable VP8 and H.264 HW encoders on Exynos devices.
Run VP8 HW only on M and above devices.

Exynos H.264 HW encoder does not use frame timestamps for
bitrate allocation, so bitrate target need to be adjusted based
on current camera frame rate.

BUG=b/28738766
R=magjed@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#12900}
2016-05-25 23:17:48 +00:00
nisse
47ac4620c8 Delete AndroidVideoCapturer::FrameFactory.
Splits VideoCapturer::OnFrameCaptured into helper methods,
which enables use of the VideoAdaptation logic without
using a frame factory.

Refactors AndroidVideoCapturer to make adaptation decision
earlier, so we can crop and rotate using
NV12ToI420Rotate.

BUG=webrtc:5682

Review-Url: https://codereview.webrtc.org/1973873003
Cr-Commit-Position: refs/heads/master@{#12895}
2016-05-25 15:47:05 +00:00
nisse
6670483db8 Delete unused include of videorendererfactory.h.
BUG=webrtc:5924

Review-Url: https://codereview.webrtc.org/2003293002
Cr-Commit-Position: refs/heads/master@{#12875}
2016-05-24 14:13:11 +00:00
Peter Boström
cc1543abf3 Move H264BitstreamParser to video_coding.
Moves parser, used in video_coding/ from rtp_rtcp where it is unused.

BUG=webrtc:5678
R=asapersson@webrtc.org
TBR=glaznev@webrt.org

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

Cr-Commit-Position: refs/heads/master@{#12866}
2016-05-24 10:16:39 +00:00
sakal
47456803d9 Make Android MediaEncoder loop not run when there aren't any frames left.
This CL makes the loop stop when all frames have been delivered and
start again when a new frame is inserted.

BUG=webrtc:5680

Review-Url: https://codereview.webrtc.org/2000103002
Cr-Commit-Position: refs/heads/master@{#12860}
2016-05-24 07:17:06 +00:00
nisse
94cd3fa03a Eliminate use of IsZeroSize method
Check for dropped frames by instead checking the
frame_buffer pointer directly.

Also add RTC_DCHECK to verify that a webrtc::VideoFrame never
has video_frame_buffer_ set to nullptr (except by the default
constructor).

BUG=webrtc:5682

Review-Url: https://codereview.webrtc.org/1995343002
Cr-Commit-Position: refs/heads/master@{#12859}
2016-05-24 06:36:00 +00:00
Magnus Jedvert
181310fb6f Android: Drop old frame in SurfaceTextureHelper.startListening()
Drop any pending texture frame when SurfaceTextureHelper.startListening()
is called because the frame might be from the previous
startListening()/stopListening() capture session. This typically happens
when switching between the front/back camera, and an old frame will get
incorrect rotation and mirroring because of the front/back camera
mismatch.

Dropping the frame in SurfaceTextureHelper also removes the need for
the |dropNextFrame| logic in VideoCapturerAndroid.

R=perkj@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#12849}
2016-05-23 14:26:59 +00:00
asapersson
b432b26b5f Android: Add API for getting native histograms.
The function getAndReset returns a map which holds the name of a histogram and its samples.

This CL depends on: https://codereview.webrtc.org/1915523002/

BUG=

Review-Url: https://codereview.webrtc.org/1952223007
Cr-Commit-Position: refs/heads/master@{#12848}
2016-05-23 13:49:41 +00:00
nisse
c82d0902e1 Don't do a thread jump for incoming frames.
We're now supposed to accept incoming frames from any thread.

BUG=webrtc:5902

Review-Url: https://codereview.webrtc.org/1987663002
Cr-Commit-Position: refs/heads/master@{#12844}
2016-05-23 07:39:45 +00:00
Honghai Zhang
351d77b702 Update the type and cost of existing networks
if the network monitor detects it after the native code does.

Also set the network cost for ethernet, wifi, unknown, cellular network type to be 0, 10, 50, 900,
so that unknown networks will have lower precedence than known networks with low cost (like Wifi) but  higher precedence than known networks with high cost.

And third, infer network type based on limited name matching in Android if there is no network monitor or network monitor did not find the type.

BUG=webrtc:5890
R=pthatcher@chromium.org, pthatcher@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#12833}
2016-05-20 22:08:37 +00:00
Magnus Jedvert
a8eab866a1 Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994013004/ )
Reason for revert:
Downstream code has been updated.

Original issue's description:
> Revert of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994893002/ )
>
> Reason for revert:
> Still breaks downstream import.
>
> Original issue's description:
> > Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1979583002/ )
> >
> > Reason for revert:
> > Downstream code has been updated.
> >
> > Original issue's description:
> > > Revert of Android: Make base interface for camera1 and camera2 (patchset #3 id:80001 of https://codereview.webrtc.org/1895483002/ )
> > >
> > > Reason for revert:
> > > Breaks downstream import.
> > >
> > > Original issue's description:
> > > > Android: Make base interface for camera1 and camera2
> > > >
> > > > This CL adds a new interface CameraVideoCapturer that extends VideoCapturer with a switchCamera() function. It also moves moves CameraEventsHandler, CameraStatistics, and CameraSwitchHandler from VideoCapturerAndroid to this new interface. The purpose is to prepare for a camera2 implementation that will use the same interfaces and helper class.
> > > >
> > > > BUG=webrtc:5519
> > > >
> > > > Committed: https://crrev.com/6bdacaddfb18edef1f0cdd778209f6b05a8f9210
> > > > Cr-Commit-Position: refs/heads/master@{#12723}
> > >
> > > TBR=perkj@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:5519
> > >
> > > Committed: https://crrev.com/181b5ffdf036427d92929667d9d43bbcff560435
> > > Cr-Commit-Position: refs/heads/master@{#12727}
> >
> > TBR=perkj@webrtc.org
> > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > BUG=webrtc:5519
> >
> > Committed: https://crrev.com/d269b023bfe1c321798fe9c8dbd631a562914fe1
> > Cr-Commit-Position: refs/heads/master@{#12807}
>
> TBR=perkj@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5519
>
> Committed: https://crrev.com/bd76607abb712f98c01709f240f147e4bd49df6d
> Cr-Commit-Position: refs/heads/master@{#12809}

TBR=perkj@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5519

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

Cr-Commit-Position: refs/heads/master@{#12830}
2016-05-20 15:22:25 +00:00
nisse
04ebea3629 Delete obsolete cricket::VideoFrame methods.
GetWidth and GetHeight (renamed to width and height),

GetNativeHandle (replaced by video_frame_buffer()->native_handle).

TBR=tkchin@webrtc.org (trivial changes to objc RTCVideoFrame and VideoRendererAdapter)

BUG=webrtc:5682

Review-Url: https://codereview.webrtc.org/1990063005
Cr-Commit-Position: refs/heads/master@{#12822}
2016-05-20 08:48:53 +00:00
magjed
bd76607abb Revert of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1994893002/ )
Reason for revert:
Still breaks downstream import.

Original issue's description:
> Reland of Android: Make base interface for camera1 and camera2 (patchset #1 id:1 of https://codereview.webrtc.org/1979583002/ )
>
> Reason for revert:
> Downstream code has been updated.
>
> Original issue's description:
> > Revert of Android: Make base interface for camera1 and camera2 (patchset #3 id:80001 of https://codereview.webrtc.org/1895483002/ )
> >
> > Reason for revert:
> > Breaks downstream import.
> >
> > Original issue's description:
> > > Android: Make base interface for camera1 and camera2
> > >
> > > This CL adds a new interface CameraVideoCapturer that extends VideoCapturer with a switchCamera() function. It also moves moves CameraEventsHandler, CameraStatistics, and CameraSwitchHandler from VideoCapturerAndroid to this new interface. The purpose is to prepare for a camera2 implementation that will use the same interfaces and helper class.
> > >
> > > BUG=webrtc:5519
> > >
> > > Committed: https://crrev.com/6bdacaddfb18edef1f0cdd778209f6b05a8f9210
> > > Cr-Commit-Position: refs/heads/master@{#12723}
> >
> > TBR=perkj@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=webrtc:5519
> >
> > Committed: https://crrev.com/181b5ffdf036427d92929667d9d43bbcff560435
> > Cr-Commit-Position: refs/heads/master@{#12727}
>
> TBR=perkj@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=webrtc:5519
>
> Committed: https://crrev.com/d269b023bfe1c321798fe9c8dbd631a562914fe1
> Cr-Commit-Position: refs/heads/master@{#12807}

TBR=perkj@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/1994013004
Cr-Commit-Position: refs/heads/master@{#12809}
2016-05-19 11:23:06 +00:00