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

[Bug] adding a track to the playlist often causes an audio glitch #359

Open
rhetr opened this issue Jan 30, 2022 · 4 comments
Open

[Bug] adding a track to the playlist often causes an audio glitch #359

rhetr opened this issue Jan 30, 2022 · 4 comments
Assignees

Comments

@rhetr
Copy link

rhetr commented Jan 30, 2022

often when I add a track to the playlist eg with !link, the audio playback will stutter/glitch, sometimes for up to a second. I also see in htop that the cpu usage of jjmumblebot goes past 100% when it is glitching. it looks like whatever new process is created briefly uses 100% of the cpu, which causes the glitch.

@DuckBoss
Copy link
Owner

Unfortunately this isn't something that can be fixed easily, the track provided from the link is prepared and the metadata/thumbnail image data is downloaded causing brief stuttering. There isn't really much I can do to optimize this further at this time.

@rhetr
Copy link
Author

rhetr commented Jan 31, 2022

not sure if this is usable but i just tried the following in cmd_link:

            # song_data = md_utility.get_video_info(stripped_url)
            from multiprocessing import Process, Queue
            q = Queue()
            p1 = Process(target = md_utility.get_video_info, args = (stripped_url, q))
            p1.start()
            song_data = q.get()
            p1.join()

then I added q = None as an arg to media_utility.get_video_info:

def get_video_info(video_url, q = None):
...
            prep_struct = {
                'std_url': video_url,
                'main_url': info_dict['url'],
                'main_title': info_dict['title'],
                'main_id': info_dict['id'],
                'duration': info_dict['duration']
            }
            if q:
                q.put(prep_struct)
                return

in preliminary tests there seems to be no glitching :) do you think this might make sense to use?

@DuckBoss
Copy link
Owner

That's an interesting solution, I'll have to test it out after I fix some other issues!

@DuckBoss
Copy link
Owner

Your solution seems to work! I'll have to keep testing it further to see if it breaks anywhere, but so far it's looking good.

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

No branches or pull requests

2 participants