mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Skip some first frames.
This commit is contained in:
parent
ccc6c6daa5
commit
9b9c3d788d
2 changed files with 17 additions and 6 deletions
|
@ -35,6 +35,7 @@ constexpr auto kBlurredSize = 64;
|
||||||
constexpr auto kMinithumbsPerSecond = 5;
|
constexpr auto kMinithumbsPerSecond = 5;
|
||||||
constexpr auto kMinithumbsInRow = 16;
|
constexpr auto kMinithumbsInRow = 16;
|
||||||
constexpr auto kFadeDuration = crl::time(150);
|
constexpr auto kFadeDuration = crl::time(150);
|
||||||
|
constexpr auto kSkipFrames = 8;
|
||||||
|
|
||||||
using namespace FFmpeg;
|
using namespace FFmpeg;
|
||||||
|
|
||||||
|
@ -1317,15 +1318,23 @@ void RoundVideoRecorder::setup() {
|
||||||
}
|
}
|
||||||
}, raw->lifetime());
|
}, raw->lifetime());
|
||||||
|
|
||||||
|
// Skip some frames, they are sometimes black :(
|
||||||
|
_skipFrames = kSkipFrames;
|
||||||
|
_descriptor.track->setState(Webrtc::VideoState::Active);
|
||||||
|
|
||||||
_descriptor.track->renderNextFrame() | rpl::start_with_next([=] {
|
_descriptor.track->renderNextFrame() | rpl::start_with_next([=] {
|
||||||
const auto info = _descriptor.track->frameWithInfo(true);
|
const auto info = _descriptor.track->frameWithInfo(true);
|
||||||
if (!info.original.isNull() && _lastAddedIndex != info.index) {
|
if (!info.original.isNull() && _lastAddedIndex != info.index) {
|
||||||
_lastAddedIndex = info.index;
|
_lastAddedIndex = info.index;
|
||||||
_frameOriginal = info.original;
|
if (_skipFrames > 0) {
|
||||||
const auto ts = info.mcstimestamp;
|
--_skipFrames;
|
||||||
_private.with([copy = info.original, ts](Private &that) {
|
} else {
|
||||||
that.push(ts, copy);
|
_frameOriginal = info.original;
|
||||||
});
|
const auto ts = info.mcstimestamp;
|
||||||
|
_private.with([copy = info.original, ts](Private &that) {
|
||||||
|
that.push(ts, copy);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_descriptor.track->markFrameShown();
|
_descriptor.track->markFrameShown();
|
||||||
raw->update();
|
raw->update();
|
||||||
|
@ -1412,9 +1421,10 @@ void RoundVideoRecorder::resume(RoundVideoPartial partial) {
|
||||||
if (!_cachedPreviewFrame.image.isNull()) {
|
if (!_cachedPreviewFrame.image.isNull()) {
|
||||||
_fadePreviewAnimation.start(updater(), 1., 0., kFadeDuration);
|
_fadePreviewAnimation.start(updater(), 1., 0., kFadeDuration);
|
||||||
}
|
}
|
||||||
|
// Skip some frames, they are sometimes black :(
|
||||||
|
_skipFrames = kSkipFrames;
|
||||||
_descriptor.track->setState(Webrtc::VideoState::Active);
|
_descriptor.track->setState(Webrtc::VideoState::Active);
|
||||||
_preview->update();
|
_preview->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,7 @@ private:
|
||||||
int _side = 0;
|
int _side = 0;
|
||||||
int _progressStroke = 0;
|
int _progressStroke = 0;
|
||||||
int _extent = 0;
|
int _extent = 0;
|
||||||
|
int _skipFrames = 0;
|
||||||
bool _progressReceived = false;
|
bool _progressReceived = false;
|
||||||
bool _visible = false;
|
bool _visible = false;
|
||||||
bool _paused = false;
|
bool _paused = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue