mirror of
https://codeberg.org/monocles/monocles_chat.git
synced 2025-01-15 14:12:21 +01:00
Fix and improve voice recording, default to opus
This commit is contained in:
parent
dcb005c47e
commit
5a1ce4c7bd
2 changed files with 6 additions and 5 deletions
|
@ -5328,10 +5328,11 @@ public class ConversationFragment extends XmppFragment
|
|||
}
|
||||
final int outputFormat;
|
||||
if (("opus".equals(userChosenCodec) || ("".equals(userChosenCodec) && Config.USE_OPUS_VOICE_MESSAGES)) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
outputFormat = MediaRecorder.OutputFormat.OGG;
|
||||
outputFormat = MediaRecorder.OutputFormat.WEBM;
|
||||
mRecorder.setOutputFormat(outputFormat);
|
||||
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.OPUS);
|
||||
mRecorder.setAudioEncodingBitRate(32000);
|
||||
mRecorder.setAudioEncodingBitRate(64000);
|
||||
mRecorder.setAudioSamplingRate(48000);
|
||||
} else if ("mpeg4".equals(userChosenCodec) || !Config.USE_OPUS_VOICE_MESSAGES) {
|
||||
outputFormat = MediaRecorder.OutputFormat.MPEG_4;
|
||||
mRecorder.setOutputFormat(outputFormat);
|
||||
|
@ -5514,8 +5515,8 @@ public class ConversationFragment extends XmppFragment
|
|||
final String extension;
|
||||
if (outputFormat == MediaRecorder.OutputFormat.MPEG_4) {
|
||||
extension = "m4a";
|
||||
} else if (outputFormat == MediaRecorder.OutputFormat.OGG) {
|
||||
extension = "oga";
|
||||
} else if (outputFormat == MediaRecorder.OutputFormat.WEBM) {
|
||||
extension = "opus";
|
||||
} else if (outputFormat == MediaRecorder.OutputFormat.THREE_GPP) {
|
||||
extension = "awb";
|
||||
} else {
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
android:key="clear_blocked_media" />
|
||||
<ListPreference
|
||||
android:title="@string/voice_message_codec"
|
||||
android:defaultValue="mpeg4"
|
||||
android:defaultValue="opus"
|
||||
android:entries="@array/voice_codec_entries"
|
||||
android:entryValues="@array/voice_codec_values"
|
||||
android:key="voice_message_codec"
|
||||
|
|
Loading…
Reference in a new issue