mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Fix possible std::clamp contract violation.
This commit is contained in:
parent
6eaa192f51
commit
e7ccf5d8ad
1 changed files with 6 additions and 1 deletions
|
@ -28,7 +28,12 @@ crl::time FramePosition(const Stream &stream) {
|
||||||
: (stream.decodedFrame->pts != AV_NOPTS_VALUE)
|
: (stream.decodedFrame->pts != AV_NOPTS_VALUE)
|
||||||
? stream.decodedFrame->pts
|
? stream.decodedFrame->pts
|
||||||
: stream.decodedFrame->pkt_dts;
|
: stream.decodedFrame->pkt_dts;
|
||||||
return FFmpeg::PtsToTime(pts, stream.timeBase);
|
const auto result = FFmpeg::PtsToTime(pts, stream.timeBase);
|
||||||
|
|
||||||
|
// Sometimes the result here may be larger than the stream duration.
|
||||||
|
return (stream.duration == kDurationUnavailable)
|
||||||
|
? result
|
||||||
|
: std::min(result, stream.duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
FFmpeg::AvErrorWrap ProcessPacket(Stream &stream, FFmpeg::Packet &&packet) {
|
FFmpeg::AvErrorWrap ProcessPacket(Stream &stream, FFmpeg::Packet &&packet) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue