Bugfix seek media player

This commit is contained in:
Bruno Herbelin
2024-01-08 19:25:29 +01:00
parent 9d27335d7d
commit 36d23b5dc2
2 changed files with 10 additions and 12 deletions

View File

@@ -1335,25 +1335,23 @@ void MediaPlayer::execute_seek_command(GstClockTime target, bool force)
if ( pipeline_ == nullptr || !media_.seekable )
return;
// ignore request to current position
if ( ABS_DIFF(target, position_) < timeline_.step())
return;
// seek position : default to target
GstClockTime seek_pos = target;
// no target given
if (target == GST_CLOCK_TIME_NONE)
// create seek event with current position (rate changed ?)
seek_pos = position_;
// target is given but useless
else if ( ABS_DIFF(target, position_) < timeline_.step()) {
// ignore request
return;
}
// seek with flush (always)
int seek_flags = GST_SEEK_FLAG_FLUSH;
if ( desired_state_ == GST_STATE_PLAYING )
// no target given
if (target == GST_CLOCK_TIME_NONE) {
// create seek event with current position (rate changed ?)
seek_pos = position_;
// seek with KEY mode if playing
seek_flags |= GST_SEEK_FLAG_KEY_UNIT | GST_SEEK_FLAG_SNAP_AFTER;
}
else
// seek with accurate timing if paused
seek_flags |= GST_SEEK_FLAG_ACCURATE;

View File

@@ -212,7 +212,7 @@ struct SourceConfig
SourceConfig() {
new_type = 0;
ratio = 3;
res = 1;
res = 6;
capture_naming = 0;
inspector_zoom = 8.f;
}