We may sometimes want to override only input or only output, or
override them with different values. This change allows setting the
overrides separately.
Change-Id: Ib0c44cb7a3cfa834f997fb6cd54f7cad68705f41
Bug: webrtc:10441
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128763
Commit-Queue: Paulina Hensman <phensman@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27236}
JNI_COMMIT doesn't actually free the buffer.
From JNI docs:
0: copy back the content and free the elems buffer
JNI_COMMIT: copy back the content but do not free the elems buffer
JNI_ABORT: free the buffer without copying back the possible changes
Also introduces helper methods to help avoid this problem in the
future.
Bug: webrtc:10132
Change-Id: I769df286d3bd186fdf39ee2363e9002f36454509
Reviewed-on: https://webrtc-review.googlesource.com/c/120600
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26529}
This is a reland of dc32cc00e8
Relanding because this CL was not the culprit for the Chrome bot.
(This code shouldn't even be executed in Chrome).
Original change's description:
> Android: Add helper methods for printing native stack traces
>
> This CL adds utility functions to unwind the stack for a given thread on
> Android ARM devices. This works on top of unwind.h and unwinds native
> (C++) stack traces only. Unwinding a thread from another thread is done
> by overriding the signal handler with a custom function and then
> interrupting the specific thread.
>
> Bug: webrtc:10168
> Change-Id: If5adffd3a6bb57bf502168743e09a7eefc292bf3
> Reviewed-on: https://webrtc-review.googlesource.com/c/118141
> Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
> Reviewed-by: Tommi <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26328}
TBR=tommi
Bug: webrtc:10168
Change-Id: I4c33c2c147cf10c0172c98a55d32dd35a08517c8
Reviewed-on: https://webrtc-review.googlesource.com/c/118704
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26341}
This CL adds utility functions to unwind the stack for a given thread on
Android ARM devices. This works on top of unwind.h and unwinds native
(C++) stack traces only. Unwinding a thread from another thread is done
by overriding the signal handler with a custom function and then
interrupting the specific thread.
Bug: webrtc:10168
Change-Id: If5adffd3a6bb57bf502168743e09a7eefc292bf3
Reviewed-on: https://webrtc-review.googlesource.com/c/118141
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26328}
This support is needed if there is a big delay between the creation of
frames and the time they are delivered to the WebRTC C++ layer in
AndroidVideoTrackSource. This is the case if e.g. some heavy video
processing is applied to the frames that takes a couple of hundred
milliseconds. Currently, timestamps coming from Android video sources
are aligned to rtc::TimeMicros() once they reach the WebRTC C++ layer in
AndroidVideoTrackSource. At this point, we "forget" any latency that
might occur before this point, and audio/video sync consequently
suffers.
Bug: webrtc:9991
Change-Id: I7b1aaca9a60a978b9195dd5e5eed4779a0055607
Reviewed-on: https://webrtc-review.googlesource.com/c/110783
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25654}
This is done in preparation of moving VideoCapturer out of
video_api_java. Clients should update to using
createVideoSource(boolean).
CapturerObserver is moved to a separate file because it needs to stay
in video_api_java to allow VideoSource to depend on it.
Bug: webrtc:9496
Change-Id: I3c93f6bc4df553919dcbe05b00ef4c68f2c9ab60
Reviewed-on: https://webrtc-review.googlesource.com/87305
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23868}
This conversion function is useful for downstream native codecs
which want to take a VideoCodecInfo in the Java wrapper and use it
as a SdpVideoFormat in the C++ object.
Bug: webrtc:9495
Change-Id: Id2ece708eafd4be648fafff9e94aa13ace504bdf
Reviewed-on: https://webrtc-review.googlesource.com/87381
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23865}
This is a no-op change because rtc::Optional is an alias to absl::optional
This CL generated by running script passing top level directories except rtc_base and api
find $@ -type f \( -name \*.h -o -name \*.cc -o -name \*.mm \) \
-exec sed -i 's|rtc::Optional|absl::optional|g' {} \+ \
-exec sed -i 's|rtc::nullopt|absl::nullopt|g' {} \+ \
-exec sed -i 's|#include "api/optional.h"|#include "absl/types/optional.h"|' {} \+
find $@ -type f -name BUILD.gn \
-exec sed -r -i 's|"[\./api]*:optional"|"//third_party/abseil-cpp/absl/types:optional"|' {} \+;
git cl format
Bug: webrtc:9078
Change-Id: I9465c172e65ba6e6ed4e4fdc35b0b265038d6f71
Reviewed-on: https://webrtc-review.googlesource.com/84584
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23697}
This CL removes the use of the @JNINamespace annotation and instead
sets the correct JNI namespace in the build file.
Bug: webrtc:8278
Change-Id: Ia4490399e45a97d56b02c260fd80df4edfa092bf
Reviewed-on: https://webrtc-review.googlesource.com/76440
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23299}
Adds Android native API for creating VideoTrackSourceInterface objects
that can be fed frames using VideoCapturer.CapturerObserver.
NativeCapturerObserver is moved out of VideoSource because it will now
be used without a VideoSource. It now takes a pointer to
AndroidVideoTrackSource directly instead of VideoTrackSourceProxy.
VideoSource and NativeCapturerObserver JNI code is moved away from
androidvideotracksource.cc to their own files. This allows using
AndroidVideoTrackSource independently.
Bug: webrtc:8769
Change-Id: Ifb9e1eb27d4c8237597d19d932ca6e863abb4d27
Reviewed-on: https://webrtc-review.googlesource.com/76924
Reviewed-by: Paulina Hensman <phensman@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23269}
This will return all the fmtp parameters for the codecs, except for
DTMF codes that don't fit the key=value pattern.
Bug: webrtc:7112
Change-Id: I06a203ff64df2c3bc9bc2082cd0f374718b23510
Reviewed-on: https://webrtc-review.googlesource.com/71801
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23250}
Start using JniIntWrapper from Chromium instead of bypassing
it in jni_generator_helper.h.
Bug: webrtc:8278
Change-Id: I20313e1e610b05f79c210e823ab50cfb2073674e
Reviewed-on: https://webrtc-review.googlesource.com/74841
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23230}
The new ADM code removed some redundancies, which led to a decrease in
log output. This especially affected NS and AEC logs. This change
reintroduces these log messages, making debugging easier. "Acoustic
Echo Canceler" has been changed to AEC for easier grepping.
Some new logging is also added.
Bug: webrtc:7452
Change-Id: I9bfb91895931d73d92f3187c8c7c5b7524ac05ba
Reviewed-on: https://webrtc-review.googlesource.com/71401
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23003}
This CL introduces sdk/android/api/org/webrtc/audio/AudioDeviceModule.java,
which is the new interface for audio device modules on Android.
This CL also refactors the main AudioDeviceModule implementation, which
is sdk/android/api/org/webrtc/audio/JavaAudioDeviceModule.java and makes
it conform to the new interface. The old code used global static methods
to configure the audio device code. This CL gets rid of all that and uses
a builder pattern in JavaAudioDeviceModule instead. The only two dynamic
methods left in the interface are setSpeakerMute() and setMicrophoneMute().
Removing the global static methods allowed a significant cleanup, and e.g.
the file sdk/android/src/jni/audio_device/audio_manager.cc has been
completely removed.
The PeerConnectionFactory interface is also updated to allow passing in
an external AudioDeviceModule. The current built-in ADM is encapsulated
under LegacyAudioDeviceModule.java, which is the default for now to
ensure backwards compatibility.
Bug: webrtc:7452
Change-Id: I64d5f4dba9a004da001f1acb2bd0c1b1f2b64f21
Reviewed-on: https://webrtc-review.googlesource.com/65360
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Paulina Hensman <phensman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22765}
The OpenSLES engine is currently managed by the AudioManager which is
a generic class shared between different kinds of audio input/output.
This CL moves the responsibility of the OpenSLES engine to the actual
OpenSLES implementations.
Bug: webrtc:7452
Change-Id: Iecccb03ec5cd12ce2f3fdc44daaedae27aecf88b
Reviewed-on: https://webrtc-review.googlesource.com/64520
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Paulina Hensman <phensman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22661}
Add support for creating java PeerConnectionFactory from native one
by adding:
1. Constructor from native pointer in java PeerConnectionFactory
2. Method NativeToJavaPeerConnectionFactory in
sdk/android/native/api/peerconnection/peerconnectionfactory.h that
provides ability to convert native factory to java one.
Bug: webrtc:8946
Change-Id: Ibe8b019bd0d45849e2b16d74663d054784526746
Reviewed-on: https://webrtc-review.googlesource.com/62344
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22564}
This CL performs some simplifications and cleanups of the moved audio code.
* All JNI interaction now goes from the C++ audio manager calling into
the Java audio manager. The calls back from the Java code to the C++
audio manager are removed (this was related to caching audio parameters).
It's simpler this way because the Java code is now unaware of the C++
layer and it will be easier to make this into a Java interface.
* A bunch of state was removed that was related to caching the audio parameters.
* Some unused functions from audio manager was removed.
* The Java audio manager no longer depends on ContextUtils, and the context has
to be passed in externally instead. This is done because we want to get rid of
ContextUtils eventually.
* The selection of what AudioDeviceModule to create (AAudio, OpenSLES
input/output is now exposed in the interface. The reason is that client should
decide and create what they need explicitly instead of setting blacklists
in static global WebRTC classes. This will be more modular long term.
* Selection of what audio device module to create (OpenSLES combinations) no
longer requires instantiating a C++ AudioManager and is done with static
enumeration methods instead.
Bug: webrtc:7452
Change-Id: Iba29cf7447a1f6063abd9544d7315e10095167c8
Reviewed-on: https://webrtc-review.googlesource.com/63760
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Paulina Hensman <phensman@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22542}
This CL adds a stand-alone Android AudioDeviceModule in the
sdk/android folder. It's forked from modules/audio_device/android/
and then simplified for the Android case. The stand-alone Android
ADM is available both in the native_api and also under a field trial
in the Java API.
Bug: webrtc:7452
Change-Id: If6e558026bd0ccb52f56d78ac833339a5789d300
Reviewed-on: https://webrtc-review.googlesource.com/60541
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22517}
The app is a simple loopback demo demonstrating the usage of Android
native API. This is an initial version and I will add support for
HW codecs etc. in the future.
Bug: webrtc:8769
Change-Id: Ifb6209769dabeb8ca3185b969a1ef8afd6d84390
Reviewed-on: https://webrtc-review.googlesource.com/60540
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22385}
This adds wrappers to the following native APIs:
- SdpSemantics enum added to the RTCConfiguration
- RtpTransceiver
- PeerConnection.addTrack
- PeerConnection.removeTrack
- PeerConnection.addTransceiver
- PeerConnection.getTransceivers
These APIs are used with the new Unified Plan semantics.
Bug: webrtc:8869
Change-Id: I19443f3ff7ffc91a139ad8276331f09e57cec554
Reviewed-on: https://webrtc-review.googlesource.com/57800
Commit-Queue: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22317}
Allows passing in the application context to NetworkMonitor in
startMonitoring. The audio code will refactored once it is moved under
sdk/android.
Bug: webrtc:8937
Change-Id: I50c917a845fc4f711899a97d34c04813cc68b68c
Reviewed-on: https://webrtc-review.googlesource.com/58091
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22231}
Moves AndroidNetworkMonitor out of pc folder. Even clients not using
PeerConnection seem to be using it and it doesn't have any dependencies
to the PeerConnection API.
Bug: webrtc:8769
Change-Id: I2bdeff9f5c9925e13388fbc77aa9b264a7583548
Reviewed-on: https://webrtc-review.googlesource.com/53260
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22051}
This method used to just wrap frame when passed a native frame and
create a new one when passed non-native frame. This caused a memory
leak when a new frame was returned because the caller didn't release
the frame. Now the method always returns a new frame and the caller is
responsible for releasing it.
Bug: webrtc:8892, b/72675429
Change-Id: I06d67a6ed4c059cae1d709c51b0266f9c72fef1a
Reviewed-on: https://webrtc-review.googlesource.com/53840
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22033}
Implements JavaToNativeStringMap that is a replacement for
JavaToStdMapStrings. It uses a new template method JavaToNativeMap. Also
adds testing support for native API and a test for JavaToNativeStringMap.
Bug: webrtc:8769
Change-Id: I580d4992a899ebe02da39af450fa51d52ee9b88b
Reviewed-on: https://webrtc-review.googlesource.com/48060
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21967}
Reorganizes methods in java_types.h to logical groups. The order in
the source file matches the order in the header file.
Bug: webrtc:8769
Change-Id: Id3e1e80276a747a3d9952598207ac55493ac46b6
Reviewed-on: https://webrtc-review.googlesource.com/46146
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21842}