mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix notifications without sounds on macOS.
This commit is contained in:
parent
db9e60b4b5
commit
8287d717f8
2 changed files with 6 additions and 7 deletions
|
@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace Media::Audio {
|
namespace Media::Audio {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr auto kMaxDuration = 10 * crl::time(1000);
|
constexpr auto kMaxDuration = 3 * crl::time(1000);
|
||||||
constexpr auto kMaxStreams = 2;
|
constexpr auto kMaxStreams = 2;
|
||||||
constexpr auto kFrameSize = 4096;
|
constexpr auto kFrameSize = 4096;
|
||||||
|
|
||||||
|
@ -121,12 +121,9 @@ constexpr auto kFrameSize = 4096;
|
||||||
}
|
}
|
||||||
#endif // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
#endif // DA_FFMPEG_NEW_CHANNEL_LAYOUT
|
||||||
const auto inrate = inCodecContext->sample_rate;
|
const auto inrate = inCodecContext->sample_rate;
|
||||||
const auto rate = (inrate == 44'100 || inrate == 48'000)
|
const auto rate = 44'100;
|
||||||
? inrate
|
|
||||||
: 44'100;
|
|
||||||
outCodecContext->sample_fmt = AV_SAMPLE_FMT_S16;
|
outCodecContext->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||||
outCodecContext->time_base = AVRational{ 1, rate };
|
outCodecContext->time_base = AVRational{ 1, rate };
|
||||||
outCodecContext->bit_rate = 64 * 1024;
|
|
||||||
outCodecContext->sample_rate = rate;
|
outCodecContext->sample_rate = rate;
|
||||||
|
|
||||||
error = avcodec_open2(outCodecContext.get(), outCodec, nullptr);
|
error = avcodec_open2(outCodecContext.get(), outCodec, nullptr);
|
||||||
|
@ -342,7 +339,7 @@ QString LocalDiskCache::name(const LocalSound &sound) {
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = u"TDesktop-%1"_q.arg(sound.id
|
auto result = u"TD_%1"_q.arg(sound.id
|
||||||
? QString::number(sound.id, 16).toUpper()
|
? QString::number(sound.id, 16).toUpper()
|
||||||
: u"Default"_q);
|
: u"Default"_q);
|
||||||
const auto path = _base + u"%1.wav"_q.arg(result);
|
const auto path = _base + u"%1.wav"_q.arg(result);
|
||||||
|
|
|
@ -1277,7 +1277,9 @@ void NativeManager::doShowNotification(NotificationFields &&fields) {
|
||||||
// #TODO optimize
|
// #TODO optimize
|
||||||
auto userpicView = item->history()->peer->createUserpicView();
|
auto userpicView = item->history()->peer->createUserpicView();
|
||||||
const auto owner = &item->history()->owner();
|
const auto owner = &item->history()->owner();
|
||||||
const auto sound = fields.soundId ? [=, id = *fields.soundId] {
|
const auto withSound = fields.soundId
|
||||||
|
&& Core::App().settings().soundNotify();
|
||||||
|
const auto sound = withSound ? [=, id = *fields.soundId] {
|
||||||
return _localSoundCache.sound(id, [=] {
|
return _localSoundCache.sound(id, [=] {
|
||||||
return Core::App().notifications().lookupSoundBytes(owner, id);
|
return Core::App().notifications().lookupSoundBytes(owner, id);
|
||||||
}, [=] {
|
}, [=] {
|
||||||
|
|
Loading…
Add table
Reference in a new issue