Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The actual playback time is much larger than the timestamp #1372

Closed
zixuan-su opened this issue Aug 12, 2022 · 5 comments · Fixed by #1374
Closed

The actual playback time is much larger than the timestamp #1372

zixuan-su opened this issue Aug 12, 2022 · 5 comments · Fixed by #1374
Labels

Comments

@zixuan-su
Copy link

zixuan-su commented Aug 12, 2022

Describe the bug

I have a 120 s long message ,then I find that It takes me 324.2 s to play. The Timestamp is still about 120 s, but the difference from the actual playback time is nearly 2.7 times . The file is https://github.com/hardbyte/python-can/blob/develop/can/player.py
image

To Reproduce

Expected behavior

The actual time spent is the same as the timestamp duration

Additional context

OS and version: Ubuntu 1804
Python version: 3.9.9
python-can version: 4.0.0
python-can interface/s (if applicable):

Traceback and logs
def func():
    return "hello, world!"
@zixuan-su zixuan-su added the bug label Aug 12, 2022
@zariiii9003
Copy link
Collaborator

Could you replace this

sleep(sleep_period)

with this

            if sleep_period > 1e-3:
                sleep(sleep_period)

and check if it gets better? You have a very high message rate, i assume the sleep() call slows you down too much.

@zariiii9003
Copy link
Collaborator

try this branch please: https://github.com/zariiii9003/python-can/tree/message_sync

@zixuan-su
Copy link
Author

zixuan-su commented Aug 15, 2022

Could you replace this

sleep(sleep_period)

with this

            if sleep_period > 1e-3:
                sleep(sleep_period)

and check if it gets better? You have a very high message rate, i assume the sleep() call slows you down too much.

I replace

with _create_bus(results, **additional_config) as bus:
with LogReader(results.infile, **additional_config) as reader:

        in_sync = MessageSync(
            cast(Iterable[Message], reader),
            timestamps=results.timestamps,
            gap=results.gap,
            skip=results.skip,
        )

with

Msg_List = list(BLFReader(results.infile))

print(f"Can LogReader (Started on {datetime.now()})")
     
try:
    for message in Msg_List:
        #print(message)  
        if message.is_error_frame and not error_frames:
            continue        
        if verbosity >= 3:

It only takes 44 s to play a 120 s BLF file
image

Then I will try your suggestion

@zixuan-su
Copy link
Author

zixuan-su commented Aug 15, 2022

try this branch please: https://github.com/zariiii9003/python-can/tree/message_sync

I follow your suggestion,that`s cool !!!
image

@zariiii9003
Copy link
Collaborator

Thank you for your feedback, then i'll merge it into develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants