mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-14 18:34:49 +00:00
Fix crash in PiP with bad video files.
This commit is contained in:
parent
05df4f832b
commit
06629ad171
@ -1152,7 +1152,7 @@ void Pip::paint(QPainter &p, FrameRequest request) {
|
||||
} else {
|
||||
p.drawImage(rect, RotateFrameImage(image, _rotation));
|
||||
}
|
||||
if (_instance.player().ready()) {
|
||||
if (canUseVideoFrame()) {
|
||||
_instance.markFrameShown();
|
||||
}
|
||||
paintRadialLoading(p);
|
||||
@ -1377,8 +1377,13 @@ void Pip::restartAtSeekPosition(crl::time position) {
|
||||
updatePlaybackState();
|
||||
}
|
||||
|
||||
bool Pip::canUseVideoFrame() const {
|
||||
return _instance.player().ready()
|
||||
&& !_instance.info().video.cover.isNull();
|
||||
}
|
||||
|
||||
QImage Pip::videoFrame(const FrameRequest &request) const {
|
||||
if (_instance.player().ready()) {
|
||||
if (canUseVideoFrame()) {
|
||||
_preparedCoverStorage = QImage();
|
||||
return _instance.frame(request);
|
||||
}
|
||||
|
@ -169,6 +169,7 @@ private:
|
||||
void updatePlayPauseResumeState(const Player::TrackState &state);
|
||||
void restartAtSeekPosition(crl::time position);
|
||||
|
||||
[[nodiscard]] bool canUseVideoFrame() const;
|
||||
[[nodiscard]] QImage videoFrame(const FrameRequest &request) const;
|
||||
[[nodiscard]] QImage videoFrameForDirectPaint(
|
||||
const FrameRequest &request) const;
|
||||
|
Loading…
Reference in New Issue
Block a user