Skip to content

Error on playing paused bag - #9887

Merged
maloel merged 11 commits into
realsenseai:developmentfrom
Nir-Az:error_on_playing_paused_bag
Oct 27, 2021
Merged

Error on playing paused bag#9887
maloel merged 11 commits into
realsenseai:developmentfrom
Nir-Az:error_on_playing_paused_bag

Conversation

@Nir-Az

@Nir-Az Nir-Az commented Oct 24, 2021

Copy link
Copy Markdown
Collaborator

Fix issue #4249

When the playback pause action occurs before the first frame arrive the timestamp creation was corrupted.
A sleep between pipeline.start() and recorder.pause() was a walkaround.

This PR fix the corrupted timestamp creation

Note that the problem was at the recorder side so a new bag will be needed to resolve this playback issue.

Tracked on [DSO-14342]

@Nir-Az
Nir-Az marked this pull request as draft October 24, 2021 11:16
@Nir-Az
Nir-Az marked this pull request as ready for review October 24, 2021 11:24
@Nir-Az
Nir-Az requested a review from maloel October 24, 2021 11:24
Comment thread src/media/record/record_device.cpp
Comment thread src/media/record/record_device.cpp Outdated

auto capture_time = std::chrono::high_resolution_clock::now() - m_capture_time_base;

if (m_record_total_pause_duration > std::chrono::nanoseconds::zero())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the if really needed?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for protection and to emphasize that we only deduct the pause duration if it's non zero, probably can be removed if we like..

}
else
{
m_record_total_pause_duration += now - m_capture_time_base;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just do all of this in one line?

m_record_total_pause_duration += now - std::max( m_capture_time_base, m_time_of_pause );

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we are inside the else of if ( m_capture_time_base < m_time_of_pause )
Which means that m_capture_time_base is >= m_time_of_pause , so we don't need std::max
That's the idea, we only need the offset, I tried to explain it in the comments above

Comment thread unit-tests/live/rec-play/test-pause-playback-frames.py
record_with_pause( file_name, iterations=1, pause_delay=3, resume_delay=2 )
pipeline = rs.pipeline()
device_playback = playback( pipeline, file_name, signal_on_stop )
verify_stop_when_eof( timeout=15 )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 15?
3+2+3 = 8... we're allowing way too much for playback, no?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes :)

record_with_pause( file_name, iterations=2, pause_delay=0, resume_delay=2 )
pipeline = rs.pipeline()
device_playback = playback( pipeline, file_name, signal_on_stop )
verify_stop_when_eof( timeout=20 )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the playback finish within 10?

Any way we can set the expected time automatically, given the parameters from record_with_pause??

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to test that the BUG was fixed and it'[s not coming back.
I didn't want to test the record and playback performance as I now it's not hard realtime and we see playback test fail once in a few days..
I will add the calculated timeout + an extra time and lets see how it goes..

@maloel

maloel commented Oct 27, 2021

Copy link
Copy Markdown
Contributor

By the way, the unit-test does not cover corner cases, but we'll leave that for another test later:

  • pause before first-frame, and never resume (stop before resume)
  • stop before resume, but the pause was after the FF
  • pause and then pause again
  • resume without pause
  • resume and resume

@Nir-Az

Nir-Az commented Oct 27, 2021

Copy link
Copy Markdown
Collaborator Author

By the way, the unit-test does not cover corner cases, but we'll leave that for another test later:

  • pause before first-frame, and never resume (stop before resume)
  • stop before resume, but the pause was after the FF
  • pause and then pause again
  • resume without pause
  • resume and resume

I know but when I get a task of fixing a BUG, I fix the BUG and add a regression test that make sure this bug is not coming back ( prevention action ), I don't test the whole system...

As you said, we can add a task of expending the test..

stop_detected = True

def calc_timeout ( iterations, pause_delay):
return iterations * (pause_delay + STREAMING_DURATION) + TIMEOUT_BUFFER

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? Why isn't the resume delay in there?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The delay between pause and resume should not increase playback time as I understand it.
We are not recording at that time.
Right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, correct! I'll add a comment to that effect, thx!

@maloel
maloel merged commit f8fada3 into realsenseai:development Oct 27, 2021
maloel added a commit that referenced this pull request Oct 27, 2021
@RealSenseSupport

Copy link
Copy Markdown
Contributor

@maloel The issue was resolved by the latest SDK 2.50. Could you please try and update? Thanks!

@Nir-Az
Nir-Az deleted the error_on_playing_paused_bag branch June 7, 2022 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants