File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/AvTranscoder/transcoder Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -588,6 +588,15 @@ void StreamTranscoder::preProcessCodecLatency()
588
588
wasARewrapCase = true ;
589
589
}
590
590
591
+ if (_offset > 0 ) {
592
+ const double fps = 1.0 * _outputEncoder->getCodec ().getAVCodecContext ().time_base .den /
593
+ (_outputEncoder->getCodec ().getAVCodecContext ().time_base .num * _outputEncoder->getCodec ().getAVCodecContext ().ticks_per_frame );
594
+ const double frame_duration = 1.0 / fps;
595
+ const double output_latency_duration = frame_duration * (latency - 1 );
596
+ LOG_WARN (" Compensate for offset with codec latency by " << output_latency_duration << " seconds (fps=" << fps << " , latency=" << latency << " )" );
597
+ _offset -= output_latency_duration;
598
+ }
599
+
591
600
while ((latency--) > 0 )
592
601
{
593
602
processFrame ();
You can’t perform that action at this time.
0 commit comments