kopia lustrzana https://github.com/sh123/codec2_talkie
Increase version, do not use super frame size for OPUS
rodzic
b19dcb8ca3
commit
dda3677b00
|
@ -10,8 +10,8 @@ android {
|
||||||
applicationId "com.radio.codec2talkie"
|
applicationId "com.radio.codec2talkie"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 168
|
versionCode 169
|
||||||
versionName "1.68"
|
versionName "1.69"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.radio.codec2talkie.protocol;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
@ -10,7 +9,6 @@ import androidx.preference.PreferenceManager;
|
||||||
import com.radio.codec2talkie.protocol.message.TextMessage;
|
import com.radio.codec2talkie.protocol.message.TextMessage;
|
||||||
import com.radio.codec2talkie.protocol.position.Position;
|
import com.radio.codec2talkie.protocol.position.Position;
|
||||||
import com.radio.codec2talkie.settings.PreferenceKeys;
|
import com.radio.codec2talkie.settings.PreferenceKeys;
|
||||||
import com.radio.codec2talkie.tools.DebugTools;
|
|
||||||
import com.radio.codec2talkie.transport.Transport;
|
import com.radio.codec2talkie.transport.Transport;
|
||||||
import com.radio.opus.Opus;
|
import com.radio.opus.Opus;
|
||||||
|
|
||||||
|
@ -48,18 +46,17 @@ public class AudioOpus implements Protocol {
|
||||||
int complexity = Integer.parseInt(sharedPreferences.getString(PreferenceKeys.OPUS_COMPLEXITY, "5"));
|
int complexity = Integer.parseInt(sharedPreferences.getString(PreferenceKeys.OPUS_COMPLEXITY, "5"));
|
||||||
float pcmFrameDuration = Float.parseFloat(sharedPreferences.getString(PreferenceKeys.OPUS_FRAME_SIZE, "40"));
|
float pcmFrameDuration = Float.parseFloat(sharedPreferences.getString(PreferenceKeys.OPUS_FRAME_SIZE, "40"));
|
||||||
|
|
||||||
int superFrameSize = Integer.parseInt(sharedPreferences.getString(PreferenceKeys.CODEC2_TX_FRAME_MAX_SIZE, "48"));
|
|
||||||
_pcmFrameSize = (int)(SAMPLE_RATE / 1000 * pcmFrameDuration);
|
_pcmFrameSize = (int)(SAMPLE_RATE / 1000 * pcmFrameDuration);
|
||||||
_audioBufferSize = 10*_pcmFrameSize;
|
_audioBufferSize = 10*_pcmFrameSize;
|
||||||
|
|
||||||
_playbackAudioBuffer = new short[_audioBufferSize];
|
_playbackAudioBuffer = new short[_audioBufferSize];
|
||||||
_recordAudioEncodedBuffer = new byte[superFrameSize];
|
_recordAudioEncodedBuffer = new byte[_audioBufferSize];
|
||||||
|
|
||||||
_opusCon = Opus.create(SAMPLE_RATE, 1, Opus.OPUS_APPLICATION_VOIP, bitRate, complexity);
|
_opusCon = Opus.create(SAMPLE_RATE, 1, Opus.OPUS_APPLICATION_VOIP, bitRate, complexity);
|
||||||
if (_opusCon == 0) {
|
if (_opusCon == 0) {
|
||||||
Log.e(TAG, "Failed to create opus");
|
Log.e(TAG, "Failed to create opus");
|
||||||
}
|
}
|
||||||
Log.i(TAG, "Opus is initialized, pcm frame size: " + _pcmFrameSize + ", super frame size: " + superFrameSize);
|
Log.i(TAG, "Opus is initialized, pcm frame size: " + _pcmFrameSize + ", buffer size: " + _audioBufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -180,7 +180,7 @@
|
||||||
<string name="kiss_toast_modem_reboot">Modem reboot requested</string>
|
<string name="kiss_toast_modem_reboot">Modem reboot requested</string>
|
||||||
|
|
||||||
<string name="codec2_tx_frame_max_size_title">Maximum super frame size (bytes)</string>
|
<string name="codec2_tx_frame_max_size_title">Maximum super frame size (bytes)</string>
|
||||||
<string name="codec2_tx_frame_max_size_summary">Multiple audio codec encoded samples are aggregated into super frame not larger than this value</string>
|
<string name="codec2_tx_frame_max_size_summary">Multiple Codec2 encoded samples are aggregated into super frame not larger than this value</string>
|
||||||
|
|
||||||
<string name="usb_settings_title">USB settings</string>
|
<string name="usb_settings_title">USB settings</string>
|
||||||
<string name="usb_data_bits_title">Serial data bits</string>
|
<string name="usb_data_bits_title">Serial data bits</string>
|
||||||
|
|
|
@ -133,14 +133,7 @@
|
||||||
app:summary="@string/codec_type_settings_summary"
|
app:summary="@string/codec_type_settings_summary"
|
||||||
app:fragment="com.radio.codec2talkie.settings.SettingsActivity$SettingsCodecFragment">
|
app:fragment="com.radio.codec2talkie.settings.SettingsActivity$SettingsCodecFragment">
|
||||||
</Preference>
|
</Preference>
|
||||||
|
|
||||||
<EditTextPreference
|
|
||||||
app:key="codec2_tx_frame_max_size"
|
|
||||||
app:title="@string/codec2_tx_frame_max_size_title"
|
|
||||||
app:summary="@string/codec2_tx_frame_max_size_summary"
|
|
||||||
app:defaultValue="48">
|
|
||||||
</EditTextPreference>
|
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
app:key="codec2_recording_enabled"
|
app:key="codec2_recording_enabled"
|
||||||
app:title="@string/codec2_recorder_title"
|
app:title="@string/codec2_recorder_title"
|
||||||
|
|
|
@ -15,6 +15,13 @@
|
||||||
app:summary="%s">
|
app:summary="%s">
|
||||||
</ListPreference>
|
</ListPreference>
|
||||||
|
|
||||||
|
<EditTextPreference
|
||||||
|
app:key="codec2_tx_frame_max_size"
|
||||||
|
app:title="@string/codec2_tx_frame_max_size_title"
|
||||||
|
app:summary="@string/codec2_tx_frame_max_size_summary"
|
||||||
|
app:defaultValue="48">
|
||||||
|
</EditTextPreference>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
|
Ładowanie…
Reference in New Issue