nativeGetSupportedScalabilityModes();
34 | }
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/Loggable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import org.webrtc.Logging.Severity;
14 |
15 | /**
16 | * Java interface for WebRTC logging. The default implementation uses webrtc.Logging.
17 | *
18 | * When injected, the Loggable will receive logging from both Java and native.
19 | */
20 | public interface Loggable {
21 | public void onLogMessage(String message, Severity severity, String tag);
22 | }
23 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/ManagedAudioProcessingFactory.java:
--------------------------------------------------------------------------------
1 | package org.webrtc;
2 |
3 | /*
4 | * Copyright 2024 The WebRTC project authors. All Rights Reserved.
5 | *
6 | * Use of this source code is governed by a BSD-style license
7 | * that can be found in the LICENSE file in the root of the source
8 | * tree. An additional intellectual property rights grant can be found
9 | * in the file PATENTS. All contributing project authors may
10 | * be found in the AUTHORS file in the root of the source tree.
11 | */
12 |
13 | /** AudioProcessing factory with lifecycle management and runtime control capabilities. */
14 | public interface ManagedAudioProcessingFactory extends AudioProcessingFactory {
15 | /**
16 | * Destroys the native AudioProcessing instance.
17 | */
18 | public void destroyNative();
19 |
20 | /**
21 | * Checks if the AudioProcessing is enabled.
22 | * @return true if enabled, false otherwise.
23 | */
24 | public boolean isEnabled();
25 |
26 | /**
27 | * Sets the enabled state of the AudioProcessing.
28 | * @param enabled The desired enabled state.
29 | */
30 | public void setEnabled(boolean enabled);
31 | }
32 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/MediaCodecWrapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import android.media.MediaCodec;
14 | import android.media.MediaCodecInfo;
15 | import android.media.MediaCrypto;
16 | import android.media.MediaFormat;
17 | import android.os.Bundle;
18 | import android.view.Surface;
19 | import java.nio.ByteBuffer;
20 |
21 | /**
22 | * Subset of methods defined in {@link android.media.MediaCodec} needed by
23 | * {@link HardwareVideoEncoder} and {@link AndroidVideoDecoder}. This interface
24 | * exists to allow mocking and using a fake implementation in tests.
25 | */
26 | interface MediaCodecWrapper {
27 | void configure(MediaFormat format, Surface surface, MediaCrypto crypto, int flags);
28 |
29 | void start();
30 |
31 | void flush();
32 |
33 | void stop();
34 |
35 | void release();
36 |
37 | int dequeueInputBuffer(long timeoutUs);
38 |
39 | void queueInputBuffer(int index, int offset, int size, long presentationTimeUs, int flags);
40 |
41 | int dequeueOutputBuffer(MediaCodec.BufferInfo info, long timeoutUs);
42 |
43 | void releaseOutputBuffer(int index, boolean render);
44 |
45 | MediaFormat getInputFormat();
46 |
47 | MediaFormat getOutputFormat();
48 |
49 | MediaFormat getOutputFormat(int index);
50 |
51 | ByteBuffer getInputBuffer(int index);
52 |
53 | ByteBuffer getOutputBuffer(int index);
54 |
55 | Surface createInputSurface();
56 |
57 | void setParameters(Bundle params);
58 |
59 | MediaCodecInfo getCodecInfo();
60 | }
61 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/MediaCodecWrapperFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import java.io.IOException;
14 |
15 | interface MediaCodecWrapperFactory {
16 | /**
17 | * Creates a new {@link MediaCodecWrapper} by codec name.
18 | *
19 | * For additional information see {@link android.media.MediaCodec#createByCodecName}.
20 | */
21 | MediaCodecWrapper createByCodecName(String name) throws IOException;
22 | }
23 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/MediaSource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /** Java wrapper for a C++ MediaSourceInterface. */
14 | public class MediaSource {
15 | /** Tracks MediaSourceInterface.SourceState */
16 | public enum State {
17 | INITIALIZING,
18 | LIVE,
19 | ENDED,
20 | MUTED;
21 |
22 | @CalledByNative("State")
23 | static State fromNativeIndex(int nativeIndex) {
24 | return values()[nativeIndex];
25 | }
26 | }
27 |
28 | private final RefCountDelegate refCountDelegate;
29 | private long nativeSource;
30 |
31 | public MediaSource(long nativeSource) {
32 | refCountDelegate = new RefCountDelegate(() -> JniCommon.nativeReleaseRef(nativeSource));
33 | this.nativeSource = nativeSource;
34 | }
35 |
36 | public State state() {
37 | checkMediaSourceExists();
38 | return nativeGetState(nativeSource);
39 | }
40 |
41 | public void dispose() {
42 | checkMediaSourceExists();
43 | refCountDelegate.release();
44 | nativeSource = 0;
45 | }
46 |
47 | /** Returns a pointer to webrtc::MediaSourceInterface. */
48 | protected long getNativeMediaSource() {
49 | checkMediaSourceExists();
50 | return nativeSource;
51 | }
52 |
53 | /**
54 | * Runs code in {@code runnable} holding a reference to the media source. If the object has
55 | * already been released, does nothing.
56 | */
57 | void runWithReference(Runnable runnable) {
58 | if (refCountDelegate.safeRetain()) {
59 | try {
60 | runnable.run();
61 | } finally {
62 | refCountDelegate.release();
63 | }
64 | }
65 | }
66 |
67 | private void checkMediaSourceExists() {
68 | if (nativeSource == 0) {
69 | throw new IllegalStateException("MediaSource has been disposed.");
70 | }
71 | }
72 |
73 | private static native State nativeGetState(long pointer);
74 | }
75 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/NativeCapturerObserver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import org.webrtc.VideoFrame;
14 |
15 | /**
16 | * Used from native api and implements a simple VideoCapturer.CapturerObserver that feeds frames to
17 | * a webrtc::jni::AndroidVideoTrackSource.
18 | */
19 | class NativeCapturerObserver implements CapturerObserver {
20 | private final NativeAndroidVideoTrackSource nativeAndroidVideoTrackSource;
21 |
22 | @CalledByNative
23 | public NativeCapturerObserver(long nativeSource) {
24 | this.nativeAndroidVideoTrackSource = new NativeAndroidVideoTrackSource(nativeSource);
25 | }
26 |
27 | @Override
28 | public void onCapturerStarted(boolean success) {
29 | nativeAndroidVideoTrackSource.setState(success);
30 | }
31 |
32 | @Override
33 | public void onCapturerStopped() {
34 | nativeAndroidVideoTrackSource.setState(/* isLive= */ false);
35 | }
36 |
37 | @Override
38 | public void onFrameCaptured(VideoFrame frame) {
39 | final VideoProcessor.FrameAdaptationParameters parameters =
40 | nativeAndroidVideoTrackSource.adaptFrame(frame);
41 | if (parameters == null) {
42 | // Drop frame.
43 | return;
44 | }
45 |
46 | final VideoFrame.Buffer adaptedBuffer =
47 | frame.getBuffer().cropAndScale(parameters.cropX, parameters.cropY, parameters.cropWidth,
48 | parameters.cropHeight, parameters.scaleWidth, parameters.scaleHeight);
49 | nativeAndroidVideoTrackSource.onFrameCaptured(
50 | new VideoFrame(adaptedBuffer, frame.getRotation(), parameters.timestampNs));
51 | adaptedBuffer.release();
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/NativeExternalAudioProcessingFactory.java:
--------------------------------------------------------------------------------
1 | package org.webrtc;
2 |
3 | public class NativeExternalAudioProcessingFactory implements AudioProcessingFactory {
4 |
5 | private final String libname;
6 |
7 | public NativeExternalAudioProcessingFactory(String libname) {
8 | if (libname == null) {
9 | throw new NullPointerException("libname must not be null.");
10 | }
11 | if (libname.isEmpty()) {
12 | throw new IllegalArgumentException("libname must not be empty.");
13 | }
14 | this.libname = libname;
15 | }
16 |
17 | @Override
18 | public long createNative() {
19 | return nativeCreateAudioProcessingModule(libname);
20 | }
21 |
22 | public void destroyNative() {
23 | nativeDestroyAudioProcessingModule();
24 | }
25 |
26 | private static native long nativeCreateAudioProcessingModule(String libname);
27 |
28 |
29 | private static native void nativeDestroyAudioProcessingModule();
30 |
31 | }
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/NativeLibrary.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | class NativeLibrary {
14 | private static String TAG = "NativeLibrary";
15 |
16 | static class DefaultLoader implements NativeLibraryLoader {
17 | @Override
18 | public boolean load(String name) {
19 | Logging.d(TAG, "Loading library: " + name);
20 | System.loadLibrary(name);
21 |
22 | // Not relevant, but kept for API compatibility.
23 | return true;
24 | }
25 | }
26 |
27 | private static Object lock = new Object();
28 | private static boolean libraryLoaded;
29 |
30 | /**
31 | * Loads the native library. Clients should call PeerConnectionFactory.initialize. It will call
32 | * this method for them.
33 | */
34 | static void initialize(NativeLibraryLoader loader, String libraryName) {
35 | synchronized (lock) {
36 | if (libraryLoaded) {
37 | Logging.d(TAG, "Native library has already been loaded.");
38 | return;
39 | }
40 | Logging.d(TAG, "Loading native library: " + libraryName);
41 | libraryLoaded = loader.load(libraryName);
42 | }
43 | }
44 |
45 | /** Returns true if the library has been loaded successfully. */
46 | static boolean isLoaded() {
47 | synchronized (lock) {
48 | return libraryLoaded;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/NativeLibraryLoader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /**
14 | * Interface for loading native libraries. A custom loader can be passed to
15 | * PeerConnectionFactory.initialize.
16 | */
17 | public interface NativeLibraryLoader {
18 | /**
19 | * Loads a native library with the given name.
20 | *
21 | * @return True on success
22 | */
23 | boolean load(String name);
24 | }
25 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/NativePeerConnectionFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /** Factory for creating webrtc::jni::OwnedPeerConnection instances. */
14 | public interface NativePeerConnectionFactory {
15 | /**
16 | * Create a new webrtc::jni::OwnedPeerConnection instance and returns a pointer to it.
17 | * The caller takes ownership of the object.
18 | */
19 | long createNativePeerConnection();
20 | }
21 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/NetEqFactoryFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /**
14 | * Implementations of this interface can create a native {@code webrtc::NetEqFactory}.
15 | */
16 | public interface NetEqFactoryFactory {
17 | /**
18 | * Returns a pointer to a {@code webrtc::NetEqFactory}. The caller takes ownership.
19 | */
20 | long createNativeNetEqFactory();
21 | }
22 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/NetworkChangeDetectorFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import android.content.Context;
14 |
15 | public interface NetworkChangeDetectorFactory {
16 | public NetworkChangeDetector create(NetworkChangeDetector.Observer observer, Context context);
17 | }
18 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/NetworkControllerFactoryFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /** Factory for creating webrtc::NetworkControllerFactory instances. */
14 | public interface NetworkControllerFactoryFactory {
15 | /**
16 | * Dynamically allocates a webrtc::NetworkControllerFactory instance and returns a pointer to
17 | * it. The caller takes ownership of the object.
18 | */
19 | public long createNativeNetworkControllerFactory();
20 | }
21 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/NetworkPreference.java:
--------------------------------------------------------------------------------
1 | package org.webrtc;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | @Retention(RetentionPolicy.SOURCE)
7 | public @interface NetworkPreference {
8 | int NEUTRAL = 0;
9 | int NOT_PREFERRED = -1;
10 | }
11 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/NetworkStatePredictorFactoryFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /** Factory for creating webrtc::NetworkStatePredictorFactory instances. */
14 | public interface NetworkStatePredictorFactoryFactory {
15 | /**
16 | * Dynamically allocates a webrtc::NetworkStatePredictorFactory instance and returns a pointer to
17 | * it. The caller takes ownership of the object.
18 | */
19 | public long createNativeNetworkStatePredictorFactory();
20 | }
21 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/OWNERS:
--------------------------------------------------------------------------------
1 | per-file Camera*=xalep@webrtc.org
2 | per-file Histogram.java=xalep@webrtc.org
3 | per-file Metrics.java=xalep@webrtc.org
4 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/PeerConnectionDependencies.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import androidx.annotation.Nullable;
14 |
15 | /**
16 | * PeerConnectionDependencies holds all PeerConnection dependencies that are
17 | * applied per PeerConnection. A dependency is distinct from a configuration
18 | * as it defines significant executable code that can be provided by a user of
19 | * the API.
20 | */
21 | public final class PeerConnectionDependencies {
22 | // Mandatory dependencies.
23 | private final PeerConnection.Observer observer;
24 |
25 | // Optional fields.
26 | private final SSLCertificateVerifier sslCertificateVerifier;
27 |
28 | public static class Builder {
29 | private PeerConnection.Observer observer;
30 | private SSLCertificateVerifier sslCertificateVerifier;
31 |
32 | private Builder(PeerConnection.Observer observer) {
33 | this.observer = observer;
34 | }
35 |
36 | public Builder setSSLCertificateVerifier(SSLCertificateVerifier sslCertificateVerifier) {
37 | this.sslCertificateVerifier = sslCertificateVerifier;
38 | return this;
39 | }
40 |
41 | // Observer is a required dependency and so is forced in the construction of the object.
42 | public PeerConnectionDependencies createPeerConnectionDependencies() {
43 | return new PeerConnectionDependencies(observer, sslCertificateVerifier);
44 | }
45 | }
46 |
47 | public static Builder builder(PeerConnection.Observer observer) {
48 | return new Builder(observer);
49 | }
50 |
51 | PeerConnection.Observer getObserver() {
52 | return observer;
53 | }
54 |
55 | @Nullable
56 | SSLCertificateVerifier getSSLCertificateVerifier() {
57 | return sslCertificateVerifier;
58 | }
59 |
60 | private PeerConnectionDependencies(
61 | PeerConnection.Observer observer, SSLCertificateVerifier sslCertificateVerifier) {
62 | this.observer = observer;
63 | this.sslCertificateVerifier = sslCertificateVerifier;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/PlatformSoftwareVideoDecoderFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import android.media.MediaCodecInfo;
14 | import androidx.annotation.Nullable;
15 | import java.util.Arrays;
16 |
17 | /** Factory for Android platform software VideoDecoders. */
18 | public class PlatformSoftwareVideoDecoderFactory extends MediaCodecVideoDecoderFactory {
19 | /**
20 | * Default allowed predicate.
21 | */
22 | private static final Predicate defaultAllowedPredicate =
23 | new Predicate() {
24 | @Override
25 | public boolean test(MediaCodecInfo arg) {
26 | return MediaCodecUtils.isSoftwareOnly(arg);
27 | }
28 | };
29 |
30 | /**
31 | * Creates a PlatformSoftwareVideoDecoderFactory that supports surface texture rendering.
32 | *
33 | * @param sharedContext The textures generated will be accessible from this context. May be null,
34 | * this disables texture support.
35 | */
36 | public PlatformSoftwareVideoDecoderFactory(@Nullable EglBase.Context sharedContext) {
37 | super(sharedContext, defaultAllowedPredicate);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/Priority.java:
--------------------------------------------------------------------------------
1 | package org.webrtc;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | @Retention(RetentionPolicy.SOURCE)
7 | public @interface Priority {
8 | int VERY_LOW = 0;
9 | int LOW = 1;
10 | int MEDIUM = 2;
11 | int HIGH = 3;
12 | }
13 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/RTCStatsCollectorCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /** Interface for receiving stats reports (see webrtc::RTCStatsCollectorCallback). */
14 | public interface RTCStatsCollectorCallback {
15 | /** Called when the stats report is ready. */
16 | @CalledByNative public void onStatsDelivered(RTCStatsReport report);
17 | }
18 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/RTCStatsReport.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import java.util.Map;
14 |
15 | /**
16 | * Java version of webrtc::RTCStatsReport. Each RTCStatsReport produced by
17 | * getStats contains multiple RTCStats objects; one for each underlying object
18 | * (codec, stream, transport, etc.) that was inspected to produce the stats.
19 | */
20 | public class RTCStatsReport {
21 | private final long timestampUs;
22 | private final Map stats;
23 |
24 | public RTCStatsReport(long timestampUs, Map stats) {
25 | this.timestampUs = timestampUs;
26 | this.stats = stats;
27 | }
28 |
29 | // Timestamp in microseconds.
30 | public double getTimestampUs() {
31 | return timestampUs;
32 | }
33 |
34 | // Map of stats object IDs to stats objects. Can be used to easily look up
35 | // other stats objects, when they refer to each other by ID.
36 | public Map getStatsMap() {
37 | return stats;
38 | }
39 |
40 | @Override
41 | public String toString() {
42 | StringBuilder builder = new StringBuilder();
43 | builder.append("{ timestampUs: ").append(timestampUs).append(", stats: [\n");
44 | boolean first = true;
45 | for (RTCStats stat : stats.values()) {
46 | if (!first) {
47 | builder.append(",\n");
48 | }
49 | builder.append(stat);
50 | first = false;
51 | }
52 | builder.append(" ] }");
53 | return builder.toString();
54 | }
55 |
56 | // TODO(bugs.webrtc.org/8557) Use ctor directly with full Map type.
57 | @SuppressWarnings("unchecked")
58 | @CalledByNative
59 | private static RTCStatsReport create(long timestampUs, Map stats) {
60 | return new RTCStatsReport(timestampUs, stats);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/RefCountDelegate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import androidx.annotation.Nullable;
14 | import java.util.concurrent.atomic.AtomicInteger;
15 |
16 | /**
17 | * Implementation of RefCounted that executes a Runnable once the ref count reaches zero.
18 | */
19 | class RefCountDelegate implements RefCounted {
20 | private final AtomicInteger refCount = new AtomicInteger(1);
21 | private final @Nullable Runnable releaseCallback;
22 |
23 | /**
24 | * @param releaseCallback Callback that will be executed once the ref count reaches zero.
25 | */
26 | public RefCountDelegate(@Nullable Runnable releaseCallback) {
27 | this.releaseCallback = releaseCallback;
28 | }
29 |
30 | @Override
31 | public void retain() {
32 | int updated_count = refCount.incrementAndGet();
33 | if (updated_count < 2) {
34 | throw new IllegalStateException("retain() called on an object with refcount < 1");
35 | }
36 | }
37 |
38 | @Override
39 | public void release() {
40 | int updated_count = refCount.decrementAndGet();
41 | if (updated_count < 0) {
42 | throw new IllegalStateException("release() called on an object with refcount < 1");
43 | }
44 | if (updated_count == 0 && releaseCallback != null) {
45 | releaseCallback.run();
46 | }
47 | }
48 |
49 | /**
50 | * Tries to retain the object. Can be used in scenarios where it is unknown if the object has
51 | * already been released. Returns true if successful or false if the object was already released.
52 | */
53 | boolean safeRetain() {
54 | int currentRefCount = refCount.get();
55 | while (currentRefCount != 0) {
56 | if (refCount.weakCompareAndSet(currentRefCount, currentRefCount + 1)) {
57 | return true;
58 | }
59 | currentRefCount = refCount.get();
60 | }
61 | return false;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/RefCounted.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /**
14 | * Interface for ref counted objects in WebRTC. These objects have significant resources that need
15 | * to be freed when they are no longer in use. Each objects starts with ref count of one when
16 | * created. If a reference is passed as a parameter to a method, the caller has ownesrship of the
17 | * object by default - calling release is not necessary unless retain is called.
18 | */
19 | public interface RefCounted {
20 | /** Increases ref count by one. */
21 | @CalledByNative void retain();
22 |
23 | /**
24 | * Decreases ref count by one. When the ref count reaches zero, resources related to the object
25 | * will be freed.
26 | */
27 | @CalledByNative void release();
28 | }
29 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/ResolutionAdjustment.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2023 Stream.io Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.webrtc
18 |
19 | /**
20 | * Resolution alignment values. Generally the [MULTIPLE_OF_16] is recommended
21 | * for both VP8 and H264
22 | */
23 | enum class ResolutionAdjustment(val value: Int) {
24 | NONE(1),
25 | MULTIPLE_OF_2(2),
26 | MULTIPLE_OF_4(4),
27 | MULTIPLE_OF_8(8),
28 | MULTIPLE_OF_16(16),
29 | }
30 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/SSLCertificateVerifier.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /**
14 | * The SSLCertificateVerifier interface allows API users to provide custom
15 | * logic to verify certificates.
16 | */
17 | public interface SSLCertificateVerifier {
18 | /**
19 | * Implementations of verify allow applications to provide custom logic for
20 | * verifying certificates. This is not required by default and should be used
21 | * with care.
22 | *
23 | * @param certificate A byte array containing a DER encoded X509 certificate.
24 | * @return True if the certificate is verified and trusted else false.
25 | */
26 | @CalledByNative boolean verify(byte[] certificate);
27 | }
28 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/SdpObserver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /** Interface for observing SDP-related events. */
14 | public interface SdpObserver {
15 | /** Called on success of Create{Offer,Answer}(). */
16 | @CalledByNative void onCreateSuccess(SessionDescription sdp);
17 |
18 | /** Called on success of Set{Local,Remote}Description(). */
19 | @CalledByNative void onSetSuccess();
20 |
21 | /** Called on error of Create{Offer,Answer}(). */
22 | @CalledByNative void onCreateFailure(String error);
23 |
24 | /** Called on error of Set{Local,Remote}Description(). */
25 | @CalledByNative void onSetFailure(String error);
26 | }
27 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/SessionDescription.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import java.util.Locale;
14 |
15 | /**
16 | * Description of an RFC 4566 Session.
17 | * SDPs are passed as serialized Strings in Java-land and are materialized
18 | * to SessionDescriptionInterface as appropriate in the JNI layer.
19 | */
20 | public class SessionDescription {
21 | /** Java-land enum version of SessionDescriptionInterface's type() string. */
22 | public static enum Type {
23 | OFFER,
24 | PRANSWER,
25 | ANSWER,
26 | ROLLBACK;
27 |
28 | public String canonicalForm() {
29 | return name().toLowerCase(Locale.US);
30 | }
31 |
32 | @CalledByNative("Type")
33 | public static Type fromCanonicalForm(String canonical) {
34 | return Type.valueOf(Type.class, canonical.toUpperCase(Locale.US));
35 | }
36 | }
37 |
38 | public final Type type;
39 | public final String description;
40 |
41 | @CalledByNative
42 | public SessionDescription(Type type, String description) {
43 | this.type = type;
44 | this.description = description;
45 | }
46 |
47 | @CalledByNative
48 | String getDescription() {
49 | return description;
50 | }
51 |
52 | @CalledByNative
53 | String getTypeInCanonicalForm() {
54 | return type.canonicalForm();
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/SimulcastVideoEncoder.java:
--------------------------------------------------------------------------------
1 | package org.webrtc;
2 |
3 | public class SimulcastVideoEncoder extends WrappedNativeVideoEncoder {
4 |
5 | static native long nativeCreateEncoder(long webrtcEnvRef, VideoEncoderFactory primary, VideoEncoderFactory fallback, VideoCodecInfo info);
6 |
7 | VideoEncoderFactory primary;
8 | VideoEncoderFactory fallback;
9 | VideoCodecInfo info;
10 |
11 | public SimulcastVideoEncoder(VideoEncoderFactory primary, VideoEncoderFactory fallback, VideoCodecInfo info) {
12 | this.primary = primary;
13 | this.fallback = fallback;
14 | this.info = info;
15 | }
16 |
17 | @Override
18 | public long createNative(long webrtcEnvRef) {
19 | return nativeCreateEncoder(webrtcEnvRef, primary, fallback, info);
20 | }
21 |
22 | @Override
23 | public boolean isHardwareEncoder() {
24 | return false;
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/SimulcastVideoEncoderFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import androidx.annotation.Nullable;
14 | import java.util.ArrayList;
15 | import java.util.HashMap;
16 | import java.util.List;
17 | import java.util.Arrays;
18 |
19 | public class SimulcastVideoEncoderFactory implements VideoEncoderFactory {
20 |
21 | static native List nativeVP9Codecs();
22 | static native VideoCodecInfo nativeAV1Codec();
23 |
24 | VideoEncoderFactory primary;
25 | VideoEncoderFactory fallback;
26 |
27 | public SimulcastVideoEncoderFactory(VideoEncoderFactory primary, VideoEncoderFactory fallback) {
28 | this.primary = primary;
29 | this.fallback = fallback;
30 | }
31 |
32 | @Nullable
33 | @Override
34 | public VideoEncoder createEncoder(VideoCodecInfo info) {
35 | return new SimulcastVideoEncoder(primary, fallback, info);
36 | }
37 |
38 | @Override
39 | public VideoCodecInfo[] getSupportedCodecs() {
40 | List codecs = new ArrayList();
41 | codecs.addAll(Arrays.asList(primary.getSupportedCodecs()));
42 | if (fallback != null) {
43 | codecs.addAll(Arrays.asList(fallback.getSupportedCodecs()));
44 | }
45 | codecs.addAll(nativeVP9Codecs());
46 | codecs.add(nativeAV1Codec());
47 | return codecs.toArray(new VideoCodecInfo[codecs.size()]);
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/Size.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /**
14 | * Class for representing size of an object. Very similar to android.util.Size but available on all
15 | * devices.
16 | */
17 | public class Size {
18 | public int width;
19 | public int height;
20 |
21 | public Size(int width, int height) {
22 | this.width = width;
23 | this.height = height;
24 | }
25 |
26 | @Override
27 | public String toString() {
28 | return width + "x" + height;
29 | }
30 |
31 | @Override
32 | public boolean equals(Object other) {
33 | if (!(other instanceof Size)) {
34 | return false;
35 | }
36 | final Size otherSize = (Size) other;
37 | return width == otherSize.width && height == otherSize.height;
38 | }
39 |
40 | @Override
41 | public int hashCode() {
42 | // Use prime close to 2^16 to avoid collisions for normal values less than 2^16.
43 | return 1 + 65537 * width + height;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/SoftwareVideoDecoderFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import androidx.annotation.Nullable;
14 | import java.util.List;
15 |
16 | public class SoftwareVideoDecoderFactory implements VideoDecoderFactory {
17 | private static final String TAG = "SoftwareVideoDecoderFactory";
18 |
19 | private final long nativeFactory;
20 |
21 | public SoftwareVideoDecoderFactory() {
22 | this.nativeFactory = nativeCreateFactory();
23 | }
24 |
25 | @Nullable
26 | @Override
27 | public VideoDecoder createDecoder(VideoCodecInfo info) {
28 | if (!nativeIsSupported(nativeFactory, info)) {
29 | Logging.w(TAG, "Trying to create decoder for unsupported format. " + info);
30 | return null;
31 | }
32 | return new WrappedNativeVideoDecoder() {
33 | @Override
34 | public long createNative(long webrtcEnvRef) {
35 | return nativeCreate(nativeFactory, webrtcEnvRef, info);
36 | }
37 | };
38 | }
39 |
40 | @Override
41 | public VideoCodecInfo[] getSupportedCodecs() {
42 | return nativeGetSupportedCodecs(nativeFactory).toArray(new VideoCodecInfo[0]);
43 | }
44 |
45 | private static native long nativeCreateFactory();
46 |
47 | private static native boolean nativeIsSupported(long factory, VideoCodecInfo info);
48 |
49 | private static native long nativeCreate(
50 | long factory, long webrtcEnvRef, VideoCodecInfo info);
51 |
52 | private static native List nativeGetSupportedCodecs(long factory);
53 | }
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/SoftwareVideoEncoderFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import androidx.annotation.Nullable;
14 | import java.util.Arrays;
15 | import java.util.List;
16 |
17 | public class SoftwareVideoEncoderFactory implements VideoEncoderFactory {
18 | private static final String TAG = "SoftwareVideoEncoderFactory";
19 |
20 | private final long nativeFactory;
21 |
22 | public SoftwareVideoEncoderFactory() {
23 | this.nativeFactory = nativeCreateFactory();
24 | }
25 |
26 | @Nullable
27 | @Override
28 | public VideoEncoder createEncoder(VideoCodecInfo info) {
29 | if (!nativeIsSupported(nativeFactory, info)) {
30 | Logging.w(TAG, "Trying to create encoder for unsupported format. " + info);
31 | return null;
32 | }
33 |
34 | return new WrappedNativeVideoEncoder() {
35 | @Override
36 | public long createNative(long webrtcEnvRef) {
37 | return nativeCreate(nativeFactory, webrtcEnvRef, info);
38 | }
39 |
40 | @Override
41 | public boolean isHardwareEncoder() {
42 | return false;
43 | }
44 | };
45 | }
46 |
47 | @Override
48 | public VideoCodecInfo[] getSupportedCodecs() {
49 | return nativeGetSupportedCodecs(nativeFactory).toArray(new VideoCodecInfo[0]);
50 | }
51 |
52 | private static native long nativeCreateFactory();
53 |
54 | private static native boolean nativeIsSupported(long factory, VideoCodecInfo info);
55 |
56 | private static native long nativeCreate(long factory, long webrtcEnvRef, VideoCodecInfo info);
57 |
58 | private static native List nativeGetSupportedCodecs(long factory);
59 | }
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/StatsObserver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /** Interface for observing Stats reports (see webrtc::StatsObservers). */
14 | public interface StatsObserver {
15 | /** Called when the reports are ready.*/
16 | @CalledByNative public void onComplete(StatsReport[] reports);
17 | }
18 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/StatsReport.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /** Java version of webrtc::StatsReport. */
14 | public class StatsReport {
15 | /** Java version of webrtc::StatsReport::Value. */
16 | public static class Value {
17 | public final String name;
18 | public final String value;
19 |
20 | @CalledByNative("Value")
21 | public Value(String name, String value) {
22 | this.name = name;
23 | this.value = value;
24 | }
25 |
26 | @Override
27 | public String toString() {
28 | StringBuilder builder = new StringBuilder();
29 | builder.append("[").append(name).append(": ").append(value).append("]");
30 | return builder.toString();
31 | }
32 | }
33 |
34 | public final String id;
35 | public final String type;
36 | // Time since 1970-01-01T00:00:00Z in milliseconds.
37 | public final double timestamp;
38 | public final Value[] values;
39 |
40 | @CalledByNative
41 | public StatsReport(String id, String type, double timestamp, Value[] values) {
42 | this.id = id;
43 | this.type = type;
44 | this.timestamp = timestamp;
45 | this.values = values;
46 | }
47 |
48 | @Override
49 | public String toString() {
50 | StringBuilder builder = new StringBuilder();
51 | builder.append("id: ")
52 | .append(id)
53 | .append(", type: ")
54 | .append(type)
55 | .append(", timestamp: ")
56 | .append(timestamp)
57 | .append(", values: ");
58 | for (int i = 0; i < values.length; ++i) {
59 | builder.append(values[i].toString()).append(", ");
60 | }
61 | return builder.toString();
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/TurnCustomizer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /** Java wrapper for a C++ TurnCustomizer. */
14 | public class TurnCustomizer {
15 | private long nativeTurnCustomizer;
16 |
17 | public TurnCustomizer(long nativeTurnCustomizer) {
18 | this.nativeTurnCustomizer = nativeTurnCustomizer;
19 | }
20 |
21 | public void dispose() {
22 | checkTurnCustomizerExists();
23 | nativeFreeTurnCustomizer(nativeTurnCustomizer);
24 | nativeTurnCustomizer = 0;
25 | }
26 |
27 | private static native void nativeFreeTurnCustomizer(long turnCustomizer);
28 |
29 | /** Return a pointer to webrtc::TurnCustomizer. */
30 | @CalledByNative
31 | long getNativeTurnCustomizer() {
32 | checkTurnCustomizerExists();
33 | return nativeTurnCustomizer;
34 | }
35 |
36 | private void checkTurnCustomizerExists() {
37 | if (nativeTurnCustomizer == 0) {
38 | throw new IllegalStateException("TurnCustomizer has been disposed.");
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/VideoCapturer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import android.content.Context;
14 |
15 | // Base interface for all VideoCapturers to implement.
16 | public interface VideoCapturer {
17 | /**
18 | * This function is used to initialize the camera thread, the android application context, and the
19 | * capture observer. It will be called only once and before any startCapture() request. The
20 | * camera thread is guaranteed to be valid until dispose() is called. If the VideoCapturer wants
21 | * to deliver texture frames, it should do this by rendering on the SurfaceTexture in
22 | * {@code surfaceTextureHelper}, register itself as a listener, and forward the frames to
23 | * CapturerObserver.onFrameCaptured(). The caller still has ownership of {@code
24 | * surfaceTextureHelper} and is responsible for making sure surfaceTextureHelper.dispose() is
25 | * called. This also means that the caller can reuse the SurfaceTextureHelper to initialize a new
26 | * VideoCapturer once the previous VideoCapturer has been disposed.
27 | */
28 | void initialize(SurfaceTextureHelper surfaceTextureHelper, Context applicationContext,
29 | CapturerObserver capturerObserver);
30 |
31 | /**
32 | * Start capturing frames in a format that is as close as possible to {@code width x height} and
33 | * {@code framerate}.
34 | */
35 | void startCapture(int width, int height, int framerate);
36 |
37 | /**
38 | * Stop capturing. This function should block until capture is actually stopped.
39 | */
40 | void stopCapture() throws InterruptedException;
41 |
42 | void changeCaptureFormat(int width, int height, int framerate);
43 |
44 | /**
45 | * Perform any final cleanup here. No more capturing will be done after this call.
46 | */
47 | void dispose();
48 |
49 | /**
50 | * @return true if-and-only-if this is a screen capturer.
51 | */
52 | boolean isScreencast();
53 | }
54 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/VideoCodecMimeType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /** Enumeration of supported video codec types. */
14 | enum VideoCodecMimeType {
15 | VP8("video/x-vnd.on2.vp8"),
16 | VP9("video/x-vnd.on2.vp9"),
17 | H264("video/avc"),
18 | AV1("video/av01"),
19 | H265("video/hevc");
20 |
21 | private final String mimeType;
22 |
23 | private VideoCodecMimeType(String mimeType) {
24 | this.mimeType = mimeType;
25 | }
26 |
27 | String mimeType() {
28 | return mimeType;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/VideoCodecStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /**
14 | * Status codes reported by video encoding/decoding components. This should be kept in sync with
15 | * video_error_codes.h.
16 | */
17 | public enum VideoCodecStatus {
18 | TARGET_BITRATE_OVERSHOOT(5),
19 | REQUEST_SLI(2),
20 | NO_OUTPUT(1),
21 | OK(0),
22 | ERROR(-1),
23 | LEVEL_EXCEEDED(-2),
24 | MEMORY(-3),
25 | ERR_PARAMETER(-4),
26 | ERR_SIZE(-5),
27 | TIMEOUT(-6),
28 | UNINITIALIZED(-7),
29 | ERR_REQUEST_SLI(-12),
30 | FALLBACK_SOFTWARE(-13);
31 |
32 | private final int number;
33 |
34 | private VideoCodecStatus(int number) {
35 | this.number = number;
36 | }
37 |
38 | @CalledByNative
39 | public int getNumber() {
40 | return number;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/VideoDecoderFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import androidx.annotation.Nullable;
14 |
15 | /** Factory for creating VideoDecoders. */
16 | public interface VideoDecoderFactory {
17 | /**
18 | * Creates a VideoDecoder for the given codec. Supports the same codecs supported by
19 | * VideoEncoderFactory.
20 | */
21 | @Nullable @CalledByNative VideoDecoder createDecoder(VideoCodecInfo info);
22 |
23 | /**
24 | * Enumerates the list of supported video codecs.
25 | */
26 | @CalledByNative
27 | default VideoCodecInfo[] getSupportedCodecs() {
28 | return new VideoCodecInfo[0];
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/VideoDecoderFallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /**
14 | * A combined video decoder that falls back on a secondary decoder if the primary decoder fails.
15 | */
16 | public class VideoDecoderFallback extends WrappedNativeVideoDecoder {
17 | private final VideoDecoder fallback;
18 | private final VideoDecoder primary;
19 |
20 | public VideoDecoderFallback(VideoDecoder fallback, VideoDecoder primary) {
21 | this.fallback = fallback;
22 | this.primary = primary;
23 | }
24 |
25 | @Override
26 | public long createNative(long webrtcEnvRef) {
27 | return nativeCreate(webrtcEnvRef, fallback, primary);
28 | }
29 |
30 | private static native long nativeCreate(
31 | long webrtcEnvRef, VideoDecoder fallback, VideoDecoder primary);
32 | }
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/VideoDecoderWrapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | import org.webrtc.VideoDecoder;
14 |
15 | /**
16 | * This class contains the Java glue code for JNI generation of VideoDecoder.
17 | */
18 | class VideoDecoderWrapper {
19 | @CalledByNative
20 | static VideoDecoder.Callback createDecoderCallback(final long nativeDecoder) {
21 | return (VideoFrame frame, Integer decodeTimeMs,
22 | Integer qp) -> nativeOnDecodedFrame(nativeDecoder, frame, decodeTimeMs, qp);
23 | }
24 |
25 | private static native void nativeOnDecodedFrame(
26 | long nativeVideoDecoderWrapper, VideoFrame frame, Integer decodeTimeMs, Integer qp);
27 | }
28 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/VideoEncoderFallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /**
14 | * A combined video encoder that falls back on a secondary encoder if the primary encoder fails.
15 | */
16 | public class VideoEncoderFallback extends WrappedNativeVideoEncoder {
17 | private final VideoEncoder fallback;
18 | private final VideoEncoder primary;
19 |
20 | public VideoEncoderFallback(VideoEncoder fallback, VideoEncoder primary) {
21 | this.fallback = fallback;
22 | this.primary = primary;
23 | }
24 |
25 | @Override
26 | public long createNative(long webrtcEnvRef) {
27 | return nativeCreate(webrtcEnvRef, fallback, primary);
28 | }
29 |
30 | @Override
31 | public boolean isHardwareEncoder() {
32 | return primary.isHardwareEncoder();
33 | }
34 |
35 | private static native long nativeCreate(
36 | long webrtcEnvRef, VideoEncoder fallback, VideoEncoder primary);
37 | }
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/VideoEncoderWrapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | // Explicit imports necessary for JNI generation.
14 | import androidx.annotation.Nullable;
15 | import org.webrtc.VideoEncoder;
16 |
17 | /**
18 | * This class contains the Java glue code for JNI generation of VideoEncoder.
19 | */
20 | class VideoEncoderWrapper {
21 | @CalledByNative
22 | static boolean getScalingSettingsOn(VideoEncoder.ScalingSettings scalingSettings) {
23 | return scalingSettings.on;
24 | }
25 |
26 | @Nullable
27 | @CalledByNative
28 | static Integer getScalingSettingsLow(VideoEncoder.ScalingSettings scalingSettings) {
29 | return scalingSettings.low;
30 | }
31 |
32 | @Nullable
33 | @CalledByNative
34 | static Integer getScalingSettingsHigh(VideoEncoder.ScalingSettings scalingSettings) {
35 | return scalingSettings.high;
36 | }
37 |
38 | @CalledByNative
39 | static VideoEncoder.Callback createEncoderCallback(final long nativeEncoder) {
40 | return (EncodedImage frame,
41 | VideoEncoder.CodecSpecificInfo info) -> nativeOnEncodedFrame(nativeEncoder, frame);
42 | }
43 |
44 | private static native void nativeOnEncodedFrame(
45 | long nativeVideoEncoderWrapper, EncodedImage frame);
46 | }
47 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/VideoFrameBufferType.java:
--------------------------------------------------------------------------------
1 | package org.webrtc;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | @Retention(RetentionPolicy.SOURCE)
7 | public @interface VideoFrameBufferType {
8 | int NATIVE = 0;
9 | int I420 = 1;
10 | int I420A = 2;
11 | int I422 = 3;
12 | int I444 = 4;
13 | int I010 = 5;
14 | int I210 = 6;
15 | int NV12 = 7;
16 | }
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/VideoSink.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /**
14 | * Java version of rtc::VideoSinkInterface.
15 | */
16 | public interface VideoSink {
17 | /**
18 | * Implementations should call frame.retain() if they need to hold a reference to the frame after
19 | * this function returns. Each call to retain() should be followed by a call to frame.release()
20 | * when the reference is no longer needed.
21 | */
22 | @CalledByNative void onFrame(VideoFrame frame);
23 | }
24 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/WebRTCException.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014-2023 Stream.io Inc. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package org.webrtc
18 |
19 | /**
20 | * Represent an exception for the RTC.
21 | */
22 | class WebRTCException(override val message: String?) : RuntimeException()
23 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/WebRtcClassLoader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /**
14 | * This class provides a ClassLoader that is capable of loading WebRTC Java classes regardless of
15 | * what thread it's called from. Such a ClassLoader is needed for the few cases where the JNI
16 | * mechanism is unable to automatically determine the appropriate ClassLoader instance.
17 | */
18 | class WebRtcClassLoader {
19 | @CalledByNative
20 | static Object getClassLoader() {
21 | Object loader = WebRtcClassLoader.class.getClassLoader();
22 | if (loader == null) {
23 | throw new RuntimeException("Failed to get WebRTC class loader.");
24 | }
25 | return loader;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/WrappedNativeVideoDecoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /**
14 | * Wraps a native webrtc::VideoDecoder.
15 | */
16 | public abstract class WrappedNativeVideoDecoder implements VideoDecoder {
17 | @Override public abstract long createNative(long webrtcEnvRef);
18 |
19 | @Override
20 | public final VideoCodecStatus initDecode(Settings settings, Callback decodeCallback) {
21 | throw new UnsupportedOperationException("Not implemented.");
22 | }
23 |
24 | @Override
25 | public final VideoCodecStatus release() {
26 | throw new UnsupportedOperationException("Not implemented.");
27 | }
28 |
29 | @Override
30 | public final VideoCodecStatus decode(EncodedImage frame, DecodeInfo info) {
31 | throw new UnsupportedOperationException("Not implemented.");
32 | }
33 |
34 | @Override
35 | public final String getImplementationName() {
36 | throw new UnsupportedOperationException("Not implemented.");
37 | }
38 | }
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/WrappedNativeVideoEncoder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc;
12 |
13 | /**
14 | * Wraps a native webrtc::VideoEncoder.
15 | */
16 | public abstract class WrappedNativeVideoEncoder implements VideoEncoder {
17 | @Override public abstract long createNative(long webrtcEnvRef);
18 | @Override public abstract boolean isHardwareEncoder();
19 |
20 | @Override
21 | public final VideoCodecStatus initEncode(Settings settings, Callback encodeCallback) {
22 | throw new UnsupportedOperationException("Not implemented.");
23 | }
24 |
25 | @Override
26 | public final VideoCodecStatus release() {
27 | throw new UnsupportedOperationException("Not implemented.");
28 | }
29 |
30 | @Override
31 | public final VideoCodecStatus encode(VideoFrame frame, EncodeInfo info) {
32 | throw new UnsupportedOperationException("Not implemented.");
33 | }
34 |
35 | @Override
36 | public final VideoCodecStatus setRateAllocation(BitrateAllocation allocation, int framerate) {
37 | throw new UnsupportedOperationException("Not implemented.");
38 | }
39 |
40 | @Override
41 | public final ScalingSettings getScalingSettings() {
42 | throw new UnsupportedOperationException("Not implemented.");
43 | }
44 |
45 | @Override
46 | public final String getImplementationName() {
47 | throw new UnsupportedOperationException("Not implemented.");
48 | }
49 | }
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/audio/AudioDeviceModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc.audio;
12 |
13 | /**
14 | * This interface is a thin wrapper on top of a native C++ webrtc::AudioDeviceModule (ADM). The
15 | * reason for basing it on a native ADM instead of a pure Java interface is that we have two native
16 | * Android implementations (OpenSLES and AAudio) that does not make sense to wrap through JNI.
17 | *
18 | * Note: This class is still under development and may change without notice.
19 | */
20 | public interface AudioDeviceModule {
21 | /**
22 | * Returns a C++ pointer to a webrtc::AudioDeviceModule. Caller does _not_ take ownership and
23 | * lifetime is handled through the release() call.
24 | */
25 | long getNativeAudioDeviceModulePointer();
26 |
27 | /**
28 | * Release resources for this AudioDeviceModule, including native resources. The object should not
29 | * be used after this call.
30 | */
31 | void release();
32 |
33 | /** Control muting/unmuting the speaker. */
34 | void setSpeakerMute(boolean mute);
35 |
36 | /** Control muting/unmuting the microphone. */
37 | void setMicrophoneMute(boolean mute);
38 |
39 | /**
40 | * Enable or disable built in noise suppressor. Returns true if the enabling was successful,
41 | * otherwise false is returned.
42 | */
43 | default boolean setNoiseSuppressorEnabled(boolean enabled) {
44 | return false;
45 | }
46 |
47 | /**
48 | * Sets the preferred field dimension for the built-in microphone. Returns
49 | * true if setting was successful, otherwise false is returned.
50 | * This functionality can be implemented with
51 | * {@code android.media.MicrophoneDirection.setPreferredMicrophoneFieldDimension}.
52 | */
53 | default boolean setPreferredMicrophoneFieldDimension(float dimension) {
54 | return false;
55 | }
56 | }
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/audio/AudioRecordDataCallback.java:
--------------------------------------------------------------------------------
1 | package org.webrtc.audio;
2 |
3 | import androidx.annotation.NonNull;
4 |
5 | import java.nio.ByteBuffer;
6 |
7 | public interface AudioRecordDataCallback {
8 | /**
9 | * Invoked after an audio sample is recorded. Can be used to manipulate
10 | * the ByteBuffer before it's fed into WebRTC. Currently the audio in the
11 | * ByteBuffer is always PCM 16bit and the buffer sample size is ~10ms.
12 | *
13 | * @param audioFormat format in android.media.AudioFormat
14 | */
15 | void onAudioDataRecorded(int audioFormat, int channelCount, int sampleRate, @NonNull ByteBuffer audioBuffer);
16 | }
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/audio/LegacyAudioDeviceModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc.audio;
12 |
13 | import org.webrtc.voiceengine.WebRtcAudioRecord;
14 | import org.webrtc.voiceengine.WebRtcAudioTrack;
15 |
16 | /**
17 | * This class represents the legacy AudioDeviceModule that is currently hardcoded into C++ WebRTC.
18 | * It will return a null native AudioDeviceModule pointer, leading to an internal object being
19 | * created inside WebRTC that is controlled by static calls to the classes under the voiceengine
20 | * package. Please use the new JavaAudioDeviceModule instead of this class.
21 | */
22 | @Deprecated
23 | public class LegacyAudioDeviceModule implements AudioDeviceModule {
24 | @Override
25 | public long getNativeAudioDeviceModulePointer() {
26 | // Returning a null pointer will make WebRTC construct the built-in legacy AudioDeviceModule for
27 | // Android internally.
28 | return 0;
29 | }
30 |
31 | @Override
32 | public void release() {
33 | // All control for this ADM goes through static global methods and the C++ object is owned
34 | // internally by WebRTC.
35 | }
36 |
37 | @Override
38 | public void setSpeakerMute(boolean mute) {
39 | WebRtcAudioTrack.setSpeakerMute(mute);
40 | }
41 |
42 | @Override
43 | public void setMicrophoneMute(boolean mute) {
44 | WebRtcAudioRecord.setMicrophoneMute(mute);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/java/org/webrtc/voiceengine/BuildInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 | *
4 | * Use of this source code is governed by a BSD-style license
5 | * that can be found in the LICENSE file in the root of the source
6 | * tree. An additional intellectual property rights grant can be found
7 | * in the file PATENTS. All contributing project authors may
8 | * be found in the AUTHORS file in the root of the source tree.
9 | */
10 |
11 | package org.webrtc.voiceengine;
12 |
13 | import android.os.Build;
14 |
15 | public final class BuildInfo {
16 | public static String getDevice() {
17 | return Build.DEVICE;
18 | }
19 |
20 | public static String getDeviceModel() {
21 | return Build.MODEL;
22 | }
23 |
24 | public static String getProduct() {
25 | return Build.PRODUCT;
26 | }
27 |
28 | public static String getBrand() {
29 | return Build.BRAND;
30 | }
31 |
32 | public static String getDeviceManufacturer() {
33 | return Build.MANUFACTURER;
34 | }
35 |
36 | public static String getAndroidBuildId() {
37 | return Build.ID;
38 | }
39 |
40 | public static String getBuildType() {
41 | return Build.TYPE;
42 | }
43 |
44 | public static String getBuildRelease() {
45 | return Build.VERSION.RELEASE;
46 | }
47 |
48 | public static int getSdkVersion() {
49 | return Build.VERSION.SDK_INT;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/stream-webrtc-android/src/main/resources/META-INF/io/getstream/stream-webrtc-android/verification.properties:
--------------------------------------------------------------------------------
1 | #This is the verification token for the io.getstream:stream-webrtc-android SDK.
2 | #Mon Jan 20 16:23:34 PST 2025
3 | token=JCIGEHGPBBA3XCTNIOMQHE7SLI
4 |
--------------------------------------------------------------------------------
/usecases.md:
--------------------------------------------------------------------------------
1 |
2 | # Who's using WebRTC Android?
3 | If your product uses WebRTC Android, welcome to contribute by creating a pull request or let me know through other contacts! 🤗
4 |
5 | ## [Stream Video SDK](https://getstream.io/video?utm_source=Github&utm_medium=Jaewoong_OSS&utm_content=Developer&utm_campaign=Github_Feb2023_Jaewoong_StreamWebRTCAndroid&utm_term=DevRelOss)
6 |
7 | 
8 |
9 | # License
10 | ```xml
11 | Copyright 2023 Stream.IO, Inc. All Rights Reserved.
12 |
13 | Licensed under the Apache License, Version 2.0 (the "License");
14 | you may not use this file except in compliance with the License.
15 | You may obtain a copy of the License at
16 |
17 | http://www.apache.org/licenses/LICENSE-2.0
18 |
19 | Unless required by applicable law or agreed to in writing, software
20 | distributed under the License is distributed on an "AS IS" BASIS,
21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | See the License for the specific language governing permissions and
23 | limitations under the License.
24 | ```
25 |
--------------------------------------------------------------------------------