Add Android native control for source audio state
This commit is contained in:
1 parent
48d538b1be
commit
c006dd5915
3 files changed
+13
No files matched your search
@@ -60,6 +60,12 @@ JNIEXPORT void JNICALL Java_com_utun_chat_data_NativeLib_nativeStreamStop(JNIEnv
|
||||
(void)env; (void)obj; android_stream_stop((uint64_t)id);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_com_utun_chat_data_NativeLib_nativeStreamSetAudioEnabled(
|
||||
JNIEnv *env, jobject obj, jlong id, jboolean enabled) {
|
||||
(void)env; (void)obj;
|
||||
return android_stream_set_audio_enabled((uint64_t)id, enabled != JNI_FALSE) == 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jlongArray JNICALL Java_com_utun_chat_data_NativeLib_nativeStreamTxStats(JNIEnv *env, jobject obj, jlong id) {
|
||||
(void)obj; struct android_stream_tx_stats s;
|
||||
if (android_stream_tx_snapshot((uint64_t)id, &s) < 0) return NULL;
|
||||
|
||||
@@ -302,6 +302,12 @@ int android_stream_feed(uint64_t id, int video, uint64_t pts, int key, const uin
|
||||
pthread_mutex_unlock(&media_lock); return result;
|
||||
}
|
||||
|
||||
int android_stream_set_audio_enabled(uint64_t id, int enabled) {
|
||||
pthread_mutex_lock(&media_lock);
|
||||
int result = stream_publisher_set_audio_enabled(transmitter, id, enabled);
|
||||
pthread_mutex_unlock(&media_lock); return result;
|
||||
}
|
||||
|
||||
/* Stop идемпотентен; publisher дренирует принятую очередь, viewer закрывается сразу в actor. */
|
||||
void android_stream_stop(uint64_t id) {
|
||||
pthread_mutex_lock(&media_lock);
|
||||
|
||||
@@ -29,6 +29,7 @@ int android_stream_open(uint64_t id, uint64_t group, uint64_t source, unsigned w
|
||||
unsigned rotation, int audio, uint64_t expected_epoch, unsigned codec);
|
||||
/* Наблюдение выбранного канала через CHAT_EVT_STREAM_SOURCES; group=0 снимает его. */
|
||||
int android_stream_watch(uint64_t group);
|
||||
int android_stream_set_audio_enabled(uint64_t id, int enabled);
|
||||
/* Видео содержит revision/размер/поворот; новая revision принимается атомарно с KEY. Для аудио format=NULL. */
|
||||
int android_stream_feed(uint64_t id, int video, uint64_t pts, int key, const uint8_t *data, size_t length,
|
||||
const struct stream_media_format *format);
|
||||
|
||||
Reference in new issue
Block a user