henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2013 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 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. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 11 | package org.webrtc; |
| 12 | |
| 13 | /** Java wrapper for a C++ MediaSourceInterface. */ |
| 14 | public class MediaSource { |
| 15 | /** Tracks MediaSourceInterface.SourceState */ |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 16 | public enum State { INITIALIZING, LIVE, ENDED, MUTED } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 17 | |
sakal | b6760f9 | 2016-09-29 04:12:44 -0700 | [diff] [blame] | 18 | final long nativeSource; // Package-protected for PeerConnectionFactory. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 19 | |
| 20 | public MediaSource(long nativeSource) { |
| 21 | this.nativeSource = nativeSource; |
| 22 | } |
| 23 | |
| 24 | public State state() { |
| 25 | return nativeState(nativeSource); |
| 26 | } |
| 27 | |
fischman@webrtc.org | 32001ef | 2013-08-12 23:26:21 +0000 | [diff] [blame] | 28 | public void dispose() { |
magjed | b1c7453 | 2017-08-27 13:47:20 -0700 | [diff] [blame] | 29 | JniCommon.nativeReleaseRef(nativeSource); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | private static native State nativeState(long pointer); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 33 | } |