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