Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update JNI libs #177

Merged
merged 5 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified resources/common/ffmpeg_av_jni.dll
Binary file not shown.
Binary file modified resources/common/libffmpeg_av_jni.jnilib
Binary file not shown.
Binary file modified resources/common/libffmpeg_av_jni.so
Binary file not shown.
Binary file modified resources/common/libffmpeg_av_jni.so__ASAN
Binary file not shown.
Binary file modified resources/common/libffmpeg_av_jni_arm64.jnilib
Binary file not shown.
Binary file modified resources/common/libffmpeg_av_jni_raspi.so
Binary file not shown.
Binary file modified resources/common/libjni_notifications.jnilib
Binary file not shown.
Binary file modified resources/common/libjni_notifications_arm64.jnilib
Binary file not shown.
242 changes: 235 additions & 7 deletions src/main/java/com/zoffcc/applications/ffmpegav/AVActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import javax.sound.sampled.*;
import java.nio.ByteBuffer;
import java.util.Random;

public class AVActivity {

private static final String TAG = "ffmpegav.AVActivity";
static final String Version = "0.99.23";
static final String Version = "0.99.24";
public static final String JAVA_AUDIO_IN_DEVICE_NAME = "Java Audio in (-fallback-)";

private static boolean java_audio_in_device_used = false;
Expand Down Expand Up @@ -42,6 +43,8 @@ public class AVActivity {
private final static int AUDIO_REC_CHANNELS = 1;
private final static int AUDIO_REC_SAMPLE_SIZE_BIT = 16;

private static boolean mult_thr_test_finish = false;

public static class ffmpegav_descrid
{
public String description;
Expand Down Expand Up @@ -275,7 +278,7 @@ private static void ffmpegav_start_java_audio_in_capture()
try {
if (t_audio_rec != null)
{
t_audio_rec.join(1000);
t_audio_rec.join(1000);
}
} catch (Exception ignored) {
} finally {
Expand Down Expand Up @@ -762,16 +765,16 @@ public static void main(String[] args) {
@Override
public void onSuccess(long width, long height, long source_width, long source_height, long pts, int fps, int source_format) {
Log.i(TAG, "ffmpeg open video capture onSuccess:" + width + " " + height + " " +
source_width + " " + source_height + " " + pts + " fps: " + fps +
" source_format: " + ffmpegav_video_source_format_name.value_str(source_format));
source_width + " " + source_height + " " + pts + " fps: " + fps +
" source_format: " + ffmpegav_video_source_format_name.value_str(source_format));
}
@Override
public void onError() {
}
@Override
public void onBufferTooSmall(int y_buffer_size, int u_buffer_size, int v_buffer_size) {
Log.i(TAG, "Video buffer too small, needed sizes: " + y_buffer_size
+ " " + u_buffer_size + " "+ v_buffer_size);
+ " " + u_buffer_size + " "+ v_buffer_size);
ffmpegav_video_buffer_2_y = java.nio.ByteBuffer.allocateDirect(y_buffer_size);
ffmpegav_video_buffer_2_u = java.nio.ByteBuffer.allocateDirect(u_buffer_size);
ffmpegav_video_buffer_2_v = java.nio.ByteBuffer.allocateDirect(v_buffer_size);
Expand Down Expand Up @@ -851,11 +854,11 @@ public void onBufferTooSmall(int audio_buffer_size) {
// -----------------------
// -----------------------
final int res_vd2 = ffmpegav_open_video_in_device(vdevice,
vsource, 640, 480, 15, 0);
vsource, 640, 480, 15, 0);
Log.i(TAG, "ffmpeg open video capture device: " + res_vd2);

final int res_ad2 = ffmpegav_open_audio_in_device_wrapper(adevice,
asource);
asource);
Log.i(TAG, "ffmpeg open audio capture device: " + res_ad2);
ffmpegav_start_video_in_capture();
ffmpegav_start_audio_in_capture_wrapper();
Expand Down Expand Up @@ -905,6 +908,231 @@ public void onBufferTooSmall(int audio_buffer_size) {
Log.i(TAG, "ffmpeg ========= all OK =========");
Log.i(TAG, "ffmpeg ========= all OK =========");


Log.i(TAG, "ffmpeg ========= multi thread test START =========");
final String vdevice_ = vdevice;
final String vsource_ = vsource;
final String adevice_ = adevice;
final String asource_ = asource;
mult_thr_test_finish = false;

Thread t1 = new Thread() {
@Override
public void run() {
Random r = new Random();
while (!mult_thr_test_finish) {
try
{
Log.i(TAG, "T1: ffmpeg open video capture device:start");
final int res_vd2 = ffmpegav_open_video_in_device(vdevice_,
vsource_, 640, 480, 15, 0);
Log.i(TAG, "T1: ffmpeg open video capture device:done");
int low = 10;
int high = 80;
int result = r.nextInt(high-low) + low;
Thread.sleep(result);
Log.i(TAG, "T1: ffmpeg close video capture device:start");
ffmpegav_close_video_in_device();
Log.i(TAG, "T1: ffmpeg close video capture device:done");
}
catch(Exception e) {}
}
}
};
Thread t2 = new Thread() {
@Override
public void run() {
Random r = new Random();
while (!mult_thr_test_finish) {
try
{
Log.i(TAG, "T2: ffmpeg open audio capture device:start");
final int res_ad2 = ffmpegav_open_audio_in_device_wrapper(adevice_, asource_);
Log.i(TAG, "T2: ffmpeg open audio capture device:done");
int low = 10;
int high = 80;
int result = r.nextInt(high-low) + low;
Thread.sleep(result);
Log.i(TAG, "T2: ffmpeg close audio capture device:start");
ffmpegav_close_audio_in_device_wrapper();
Log.i(TAG, "T2: ffmpeg close audio capture device:done");
}
catch(Exception e) {}
}
}
};
Thread t3 = new Thread() {
@Override
public void run() {
Random r = new Random();
while (!mult_thr_test_finish) {
try
{
Log.i(TAG, "T3: ffmpeg open video capture device:start");
final int res_vd2 = ffmpegav_open_video_in_device(vdevice_,
vsource_, 640, 480, 15, 0);
Log.i(TAG, "T3: ffmpeg open video capture device:done");
int low = 10;
int high = 80;
int result = r.nextInt(high-low) + low;
Thread.sleep(result);
Log.i(TAG, "T3: ffmpeg close video capture device:start");
ffmpegav_close_video_in_device();
Log.i(TAG, "T3: ffmpeg close video capture device:done");
}
catch(Exception e) {}
}
}
};
Thread t4 = new Thread() {
@Override
public void run() {
Random r = new Random();
while (!mult_thr_test_finish) {
try
{
Log.i(TAG, "T4: ffmpeg open audio capture device:start");
final int res_ad2 = ffmpegav_open_audio_in_device_wrapper(adevice_, asource_);
Log.i(TAG, "T4: ffmpeg open audio capture device:done");
int low = 10;
int high = 80;
int result = r.nextInt(high-low) + low;
Thread.sleep(result);
Log.i(TAG, "T4: ffmpeg close audio capture device:start");
ffmpegav_close_audio_in_device_wrapper();
Log.i(TAG, "T4: ffmpeg close audio capture device:done");
}
catch(Exception e) {}
}
}
};
Thread t5 = new Thread() {
@Override
public void run() {
Random r = new Random();
while (!mult_thr_test_finish) {
try
{
Log.i(TAG, "T5: ffmpeg start video capture: start");
ffmpegav_start_video_in_capture();
Log.i(TAG, "T5: ffmpeg start video capture: done");
int low = 10;
int high = 80;
int result = r.nextInt(high-low) + low;
Thread.sleep(result);
Log.i(TAG, "T5: ffmpeg stop video capture: start");
ffmpegav_stop_video_in_capture();
Log.i(TAG, "T5: ffmpeg stop video capture: done");
}
catch(Exception e) {}
}
}
};
Thread t6 = new Thread() {
@Override
public void run() {
Random r = new Random();
while (!mult_thr_test_finish) {
try
{
Log.i(TAG, "T6: ffmpeg start audio capture: start");
ffmpegav_start_audio_in_capture_wrapper();
Log.i(TAG, "T6: ffmpeg start audio capture: done");
int low = 10;
int high = 80;
int result = r.nextInt(high-low) + low;
Thread.sleep(result);
Log.i(TAG, "T6: ffmpeg stop audio capture: start");
ffmpegav_stop_audio_in_capture_wrapper();
Log.i(TAG, "T6: ffmpeg stop audio capture: done");
}
catch(Exception e) {}
}
}
};
Thread t7 = new Thread() {
@Override
public void run() {
Random r = new Random();
while (!mult_thr_test_finish) {
try
{
Log.i(TAG, "T7: ffmpeg start video capture: start");
ffmpegav_start_video_in_capture();
Log.i(TAG, "T7: ffmpeg start video capture: done");
int low = 10;
int high = 80;
int result = r.nextInt(high-low) + low;
Thread.sleep(result);
Log.i(TAG, "T7: ffmpeg stop video capture: start");
ffmpegav_stop_video_in_capture();
Log.i(TAG, "T7: ffmpeg stop video capture: done");
}
catch(Exception e) {}
}
}
};
Thread t8 = new Thread() {
@Override
public void run() {
Random r = new Random();
while (!mult_thr_test_finish) {
try
{
Log.i(TAG, "T8: ffmpeg start audio capture: start");
ffmpegav_start_audio_in_capture_wrapper();
Log.i(TAG, "T8: ffmpeg start audio capture: done");
int low = 10;
int high = 80;
int result = r.nextInt(high-low) + low;
Thread.sleep(result);
Log.i(TAG, "T8: ffmpeg stop audio capture: start");
ffmpegav_stop_audio_in_capture_wrapper();
Log.i(TAG, "T8: ffmpeg stop audio capture: done");
}
catch(Exception e) {}
}
}
};
Log.i(TAG, "ffmpeg ========= multi thread test RUN ===========");
t1.start();
t2.start();
t3.start();
t4.start();
t5.start();
t6.start();
t7.start();
t8.start();
try
{
Thread.sleep(100000);
}
catch(Exception e)
{
}
Log.i(TAG, "ffmpeg ========= multi thread test STOP ==========");
mult_thr_test_finish = true;
ffmpegav_stop_video_in_capture();
ffmpegav_stop_audio_in_capture();
try
{
t1.join();
t2.join();
t3.join();
t4.join();
t5.join();
t6.join();
t7.join();
t8.join();
}
catch(Exception e)
{
}
ffmpegav_stop_audio_in_capture_wrapper();
ffmpegav_stop_video_in_capture();
ffmpegav_close_audio_in_device_wrapper();
ffmpegav_close_video_in_device();
Log.i(TAG, "ffmpeg ========= multi thread test OK ============");
}

public static String bytesToHex(byte[] bytes, int start, int len)
Expand Down
38 changes: 38 additions & 0 deletions src/main/kotlin/org/briarproject/briar/desktop/ui/AboutScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.ContentCopy
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand All @@ -49,11 +50,14 @@ import com.zoffcc.applications.trifa.MainActivity.Companion.libavutil_version
import com.zoffcc.applications.trifa.MainActivity.Companion.libopus_version
import com.zoffcc.applications.trifa.MainActivity.Companion.libvpx_version
import com.zoffcc.applications.trifa.MainActivity.Companion.libsodium_version
import com.zoffcc.applications.trifa.MainActivity.Companion.tox_group_get_number_groups
import com.zoffcc.applications.trifa.MainActivity.Companion.tox_version_major
import com.zoffcc.applications.trifa.MainActivity.Companion.tox_version_minor
import com.zoffcc.applications.trifa.MainActivity.Companion.tox_version_patch
import com.zoffcc.applications.trifa.MainActivity.Companion.x264_version
import com.zoffcc.applications.trifa.TrifaToxService.Companion.orma
import com.zoffcc.applications.trifa_material.trifa_material.BuildConfig
import globalstore
import org.briarproject.briar.desktop.utils.InternationalizationUtils.i18n
import org.sqlite.SQLiteJDBCLoader

Expand Down Expand Up @@ -111,6 +115,7 @@ private fun GeneralInfo() {
// format date
// val commitTime = Instant.ofEpochMilli(BuildData.GIT_TIME).atZone(ZoneId.systemDefault()).toLocalDateTime()

val global_store by globalstore.stateFlow.collectAsState()
// rows displayed in table
val lines = buildList {
// add(Entry(i18n("about.copyright"), Strings.APP_AUTHORS))
Expand All @@ -129,6 +134,39 @@ private fun GeneralInfo() {
add(Entry(i18n("about.git_commit_date"), BuildConfig.GIT_COMMIT_DATE))
add(Entry(i18n("about.git_commit_msg"), BuildConfig.GIT_COMMIT_MSG))
add(Entry(i18n("about.website"), "https://github.com/Zoxcore/trifa_material", true))
if (global_store.ormaRunning)
{
try
{
add(Entry(i18n("about.number_of_friend_messages"), orma!!.selectFromMessage().count().toString()))
} catch (_: Exception)
{
}
try
{
add(Entry(i18n("about.number_of_group_messages"), orma!!.selectFromGroupMessage().count().toString()))
} catch (_: Exception)
{
}
try
{
add(Entry(i18n("about.number_of_friends"), orma!!.selectFromFriendList().count().toString()))
} catch (_: Exception)
{
}
}

try
{
if (global_store.toxRunning)
{
// add(Entry(i18n("about.number_of_groups"), orma!!.selectFromGroupDB().count().toString()))
add(Entry(i18n("about.number_of_groups"), tox_group_get_number_groups().toString()))
}
} catch (_: Exception)
{
}


try
{
Expand Down
Loading