Skip to content

Commit

Permalink
fix: using in and seek for ffmpeg producer can result in incorrect du…
Browse files Browse the repository at this point in the history
…ration
  • Loading branch information
Julusian committed Aug 1, 2024
1 parent 1c2da14 commit 6106ad9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/modules/ffmpeg/producer/av_producer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ struct AVProducer::Impl
}

{
const auto start = firstSeek ? av_rescale_q(*firstSeek, format_tb_, TIME_BASE_Q) : start_.load();
const auto start = start_.load();
if (duration_ == AV_NOPTS_VALUE && input_->duration > 0) {
if (start != AV_NOPTS_VALUE) {
duration_ = input_->duration - start;
Expand All @@ -742,8 +742,9 @@ struct AVProducer::Impl
}
}

if (start != AV_NOPTS_VALUE) {
seek_internal(start);
const auto firstStart = firstSeek ? av_rescale_q(*firstSeek, format_tb_, TIME_BASE_Q) : start;
if (firstStart != AV_NOPTS_VALUE) {
seek_internal(firstStart);
} else {
reset(input_->start_time != AV_NOPTS_VALUE ? input_->start_time : 0);
}
Expand Down

0 comments on commit 6106ad9

Please sign in to comment.