Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions unit-tests/live/rec-play/test-got-playback-frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ def stop_sensor( sensor ):
if sensor.get_active_streams():
try:
sensor.stop()
sensor.close()
except RuntimeError as rte:
if str( rte ) != "stop_streaming() failed. UVC device is not streaming!":
test.unexpected_exception()
except Exception:
test.unexpected_exception()
sensor.close()

# create temporary folder to record to that will be deleted automatically at the end of the script
# (requires that no files are being held open inside this directory. Important to not keep any handle open to a file
Expand All @@ -127,6 +127,7 @@ def stop_sensor( sensor ):

cfg = pipeline = None
try:
# dev, ctx = test.find_first_device_or_exit() # uncomment when running in a loop
# creating a pipeline and recording to a file
pipeline = rs.pipeline(ctx)
cfg = rs.config()
Expand Down Expand Up @@ -169,11 +170,11 @@ def stop_sensor( sensor ):
time.sleep(3)

recorder.pause()

stop_sensor(depth_sensor)
stop_sensor(color_sensor)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Who is closing now?
The test will end with the resource open?
This hides an SDK BUG you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just to use the existing function to stop and close each sensor

I'm not sure this is a bug, it depends on how we expect to use the recorder, when we destroy the recorder we call rs2_delete_device, IMO it's okay

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh I get it now, missed that it's a function :)


recorder = None
color_sensor.stop()
color_sensor.close()
depth_sensor.stop()
depth_sensor.close()

color_filters = [f.get_info(rs.camera_info.name) for f in color_sensor.get_recommended_filters()]
depth_filters = [f.get_info(rs.camera_info.name) for f in depth_sensor.get_recommended_filters()]
Expand Down Expand Up @@ -239,11 +240,11 @@ def stop_sensor( sensor ):
time.sleep(3)

recorder.pause()

stop_sensor(depth_sensor)
stop_sensor(color_sensor)

recorder = None
color_sensor.stop()
color_sensor.close()
depth_sensor.stop()
depth_sensor.close()

playback = ctx.load_device( file_name )

Expand Down
Loading