mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-14 18:34:49 +00:00
linux audio capture improved
This commit is contained in:
parent
1b06fe1220
commit
0a7c42c59a
@ -23,10 +23,9 @@ Replace '\-lfontconfig' '\/usr\/lib\/x86_64\-linux\-gnu\/libfontconfig\.a \/usr\
|
||||
Replace '\-lfreetype' '\/usr\/lib\/x86_64\-linux\-gnu\/libfreetype\.a'
|
||||
Replace '\-lpng' '\/usr\/lib\/x86_64\-linux\-gnu\/libpng\.a'
|
||||
Replace '\-lXext' '\/usr\/lib\/x86_64\-linux\-gnu\/libXext\.a'
|
||||
Replace '\-lopusfile' '\/usr\/local\/lib\/libopusfile\.a'
|
||||
Replace '\-lopus' '\/usr\/local\/lib\/libopus\.a'
|
||||
Replace '\-lopenal' '\/usr\/local\/lib\/libopenal\.a'
|
||||
Replace '\-logg' '\/usr\/local\/lib\/libogg\.a'
|
||||
Replace '\-lfaad' '\/usr\/local\/lib\/libfaad\.a'
|
||||
Replace '\-lmpg123' '\/usr\/lib\/x86_64\-linux\-gnu\/libmpg123\.a'
|
||||
Replace '\-lmp4ff' '\/usr\/local\/lib\/libmp4ff\.a'
|
||||
Replace '\-lavformat' '\/usr\/local\/lib\/libavformat\.a'
|
||||
Replace '\-lavcodec' '\/usr\/local\/lib\/libavcodec\.a'
|
||||
Replace '\-lswresample' '\/usr\/local\/lib\/libswresample\.a'
|
||||
Replace '\-lavutil' '\/usr\/local\/lib\/libavutil\.a'
|
||||
|
@ -1202,8 +1202,9 @@ void AudioCaptureInner::onInit() {
|
||||
void AudioCaptureInner::onStart() {
|
||||
|
||||
// Start OpenAL Capture
|
||||
|
||||
d->device = alcCaptureOpenDevice(0, AudioVoiceMsgFrequency, AL_FORMAT_MONO16, AudioVoiceMsgFrequency / 5);
|
||||
const ALCchar *dName = alcGetString(0, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);
|
||||
DEBUG_LOG(("Audio Info: Capture device name '%1'").arg(dName));
|
||||
d->device = alcCaptureOpenDevice(dName, AudioVoiceMsgFrequency, AL_FORMAT_MONO16, AudioVoiceMsgFrequency / 5);
|
||||
if (!d->device) {
|
||||
LOG(("Audio Error: capture device not present!"));
|
||||
emit error();
|
||||
@ -1255,7 +1256,7 @@ void AudioCaptureInner::onStart() {
|
||||
emit error();
|
||||
return;
|
||||
}
|
||||
d->stream = avformat_new_stream(d->fmtContext, d->codec);
|
||||
d->stream = avformat_new_stream(d->fmtContext, d->codec);
|
||||
if (!d->stream) {
|
||||
LOG(("Audio Error: Unable to avformat_new_stream for capture"));
|
||||
onStop(false);
|
||||
@ -1267,7 +1268,8 @@ void AudioCaptureInner::onStart() {
|
||||
av_opt_set_int(d->codecContext, "refcounted_frames", 1, 0);
|
||||
|
||||
d->codecContext->sample_fmt = AV_SAMPLE_FMT_FLTP;
|
||||
d->codecContext->bit_rate = 0;// 64000;
|
||||
d->codecContext->bit_rate = 64000;
|
||||
d->codecContext->channel_layout = AV_CH_LAYOUT_MONO;
|
||||
d->codecContext->sample_rate = AudioVoiceMsgFrequency;
|
||||
d->codecContext->channels = 1;
|
||||
|
||||
@ -1342,9 +1344,10 @@ void AudioCaptureInner::onStop(bool needResult) {
|
||||
if (!_timer.isActive()) return; // in onStop() already
|
||||
_timer.stop();
|
||||
|
||||
if (needResult) {
|
||||
onTimeout(); // get last data
|
||||
}
|
||||
if (d->device) {
|
||||
alcCaptureStop(d->device);
|
||||
onTimeout(); // get last data
|
||||
}
|
||||
|
||||
// Write what is left
|
||||
if (!_captured.isEmpty()) {
|
||||
@ -1585,4 +1588,4 @@ void AudioCaptureInner::writeFrame(int32 offset, int32 framesize) {
|
||||
d->fullSamples += samplesCnt;
|
||||
|
||||
av_frame_free(&frame);
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ INCLUDEPATH += "/usr/include/atk-1.0"
|
||||
INCLUDEPATH += "/usr/include/dee-1.0"
|
||||
INCLUDEPATH += "/usr/include/libdbusmenu-glib-0.4"
|
||||
|
||||
LIBS += -lcrypto -lssl -lz -ldl -llzma -lexif -lopus -lopusfile -logg -lopenal -lfaad -lmp4ff -lmpg123
|
||||
LIBS += -lcrypto -lssl -lz -ldl -llzma -lexif -lopenal -lavformat -lavcodec -lswresample -lavutil -lopus
|
||||
LIBS += ./../../../Libraries/QtStatic/qtbase/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.a
|
||||
|
||||
RESOURCES += \
|
||||
|
Loading…
Reference in New Issue
Block a user