{"action":"opened","number":18,"pull_request":{"url":"https://api.github.com/repos/jhasse/ears/pulls/18","id":175886928,"html_url":"https://github.com/jhasse/ears/pull/18","diff_url":"https://github.com/jhasse/ears/pull/18.diff","patch_url":"https://github.com/jhasse/ears/pull/18.patch","issue_url":"https://api.github.com/repos/jhasse/ears/issues/18","number":18,"state":"open","locked":false,"title":"Fix rare buffer exhaustion bug in looped music","user":{"login":"nickbrowne","id":2295892,"avatar_url":"https://avatars3.githubusercontent.com/u/2295892?v=4","gravatar_id":"","url":"https://api.github.com/users/nickbrowne","html_url":"https://github.com/nickbrowne","followers_url":"https://api.github.com/users/nickbrowne/followers","following_url":"https://api.github.com/users/nickbrowne/following{/other_user}","gists_url":"https://api.github.com/users/nickbrowne/gists{/gist_id}","starred_url":"https://api.github.com/users/nickbrowne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickbrowne/subscriptions","organizations_url":"https://api.github.com/users/nickbrowne/orgs","repos_url":"https://api.github.com/users/nickbrowne/repos","events_url":"https://api.github.com/users/nickbrowne/events{/privacy}","received_events_url":"https://api.github.com/users/nickbrowne/received_events","type":"User","site_admin":false},"body":"Thanks for such a great library, I've been using it for a game I'm writing and it sure is convenient!\r\n\r\nI have come across a very rare and annoying to track down bug that occurs when looping music.\r\n\r\nBasically, what can happen is that if there are only a few bytes left right towards the end of reading a file, the next buffer to be queued won't be populated with enough data. By the time the thread wakes up again and attempts to re-fill the next buffer, OpenAL has already exhausted the few bytes filed in the previous buffer and put the source into an `AL_STOPPED` state. \r\n\r\nIt is quite a rare occurrence, but it sure was frustrating having my music randomly stop playing!\r\n\r\nMy fix is fairly straight forward, I've basically modified the `samples` filling code to rewind the file and continue filling if we're looping and `samples` hasn't been completely filled yet. This should ensure that there's always enough data around by the time the thread wakes up again.\r\n\r\nI'm sure there's a bit of opportunity for refactoring here, but I mainly focused on fixing the bug without changing too much.\r\n\r\nThere's also a demonstration of the issue here where I've increased the sleep time slightly, which increases the likelihood of it happening (it can still take a while to happen though):\r\nhttps://github.com/jhasse/ears/compare/master...nickbrowne:looping-example","created_at":"2018-03-19T12:39:27Z","updated_at":"2018-03-19T12:39:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/jhasse/ears/pulls/18/commits","review_comments_url":"https://api.github.com/repos/jhasse/ears/pulls/18/comments","review_comment_url":"https://api.github.com/repos/jhasse/ears/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jhasse/ears/issues/18/comments","statuses_url":"https://api.github.com/repos/jhasse/ears/statuses/59a661a848b64234bfb345d656e96ce609472c46","head":{"label":"nickbrowne:fix-buffer-exhaustion","ref":"fix-buffer-exhaustion","sha":"59a661a848b64234bfb345d656e96ce609472c46","user":{"login":"nickbrowne","id":2295892,"avatar_url":"https://avatars3.githubusercontent.com/u/2295892?v=4","gravatar_id":"","url":"https://api.github.com/users/nickbrowne","html_url":"https://github.com/nickbrowne","followers_url":"https://api.github.com/users/nickbrowne/followers","following_url":"https://api.github.com/users/nickbrowne/following{/other_user}","gists_url":"https://api.github.com/users/nickbrowne/gists{/gist_id}","starred_url":"https://api.github.com/users/nickbrowne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickbrowne/subscriptions","organizations_url":"https://api.github.com/users/nickbrowne/orgs","repos_url":"https://api.github.com/users/nickbrowne/repos","events_url":"https://api.github.com/users/nickbrowne/events{/privacy}","received_events_url":"https://api.github.com/users/nickbrowne/received_events","type":"User","site_admin":false},"repo":{"id":125681879,"name":"ears","full_name":"nickbrowne/ears","owner":{"login":"nickbrowne","id":2295892,"avatar_url":"https://avatars3.githubusercontent.com/u/2295892?v=4","gravatar_id":"","url":"https://api.github.com/users/nickbrowne","html_url":"https://github.com/nickbrowne","followers_url":"https://api.github.com/users/nickbrowne/followers","following_url":"https://api.github.com/users/nickbrowne/following{/other_user}","gists_url":"https://api.github.com/users/nickbrowne/gists{/gist_id}","starred_url":"https://api.github.com/users/nickbrowne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickbrowne/subscriptions","organizations_url":"https://api.github.com/users/nickbrowne/orgs","repos_url":"https://api.github.com/users/nickbrowne/repos","events_url":"https://api.github.com/users/nickbrowne/events{/privacy}","received_events_url":"https://api.github.com/users/nickbrowne/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nickbrowne/ears","description":"Easy Api in Rust to play Sounds","fork":true,"url":"https://api.github.com/repos/nickbrowne/ears","forks_url":"https://api.github.com/repos/nickbrowne/ears/forks","keys_url":"https://api.github.com/repos/nickbrowne/ears/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nickbrowne/ears/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nickbrowne/ears/teams","hooks_url":"https://api.github.com/repos/nickbrowne/ears/hooks","issue_events_url":"https://api.github.com/repos/nickbrowne/ears/issues/events{/number}","events_url":"https://api.github.com/repos/nickbrowne/ears/events","assignees_url":"https://api.github.com/repos/nickbrowne/ears/assignees{/user}","branches_url":"https://api.github.com/repos/nickbrowne/ears/branches{/branch}","tags_url":"https://api.github.com/repos/nickbrowne/ears/tags","blobs_url":"https://api.github.com/repos/nickbrowne/ears/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nickbrowne/ears/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nickbrowne/ears/git/refs{/sha}","trees_url":"https://api.github.com/repos/nickbrowne/ears/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nickbrowne/ears/statuses/{sha}","languages_url":"https://api.github.com/repos/nickbrowne/ears/languages","stargazers_url":"https://api.github.com/repos/nickbrowne/ears/stargazers","contributors_url":"https://api.github.com/repos/nickbrowne/ears/contributors","subscribers_url":"https://api.github.com/repos/nickbrowne/ears/subscribers","subscription_url":"https://api.github.com/repos/nickbrowne/ears/subscription","commits_url":"https://api.github.com/repos/nickbrowne/ears/commits{/sha}","git_commits_url":"https://api.github.com/repos/nickbrowne/ears/git/commits{/sha}","comments_url":"https://api.github.com/repos/nickbrowne/ears/comments{/number}","issue_comment_url":"https://api.github.com/repos/nickbrowne/ears/issues/comments{/number}","contents_url":"https://api.github.com/repos/nickbrowne/ears/contents/{+path}","compare_url":"https://api.github.com/repos/nickbrowne/ears/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nickbrowne/ears/merges","archive_url":"https://api.github.com/repos/nickbrowne/ears/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nickbrowne/ears/downloads","issues_url":"https://api.github.com/repos/nickbrowne/ears/issues{/number}","pulls_url":"https://api.github.com/repos/nickbrowne/ears/pulls{/number}","milestones_url":"https://api.github.com/repos/nickbrowne/ears/milestones{/number}","notifications_url":"https://api.github.com/repos/nickbrowne/ears/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nickbrowne/ears/labels{/name}","releases_url":"https://api.github.com/repos/nickbrowne/ears/releases{/id}","deployments_url":"https://api.github.com/repos/nickbrowne/ears/deployments","created_at":"2018-03-18T01:03:52Z","updated_at":"2018-03-18T01:03:54Z","pushed_at":"2018-03-19T12:33:42Z","git_url":"git://github.com/nickbrowne/ears.git","ssh_url":"git@github.com:nickbrowne/ears.git","clone_url":"https://github.com/nickbrowne/ears.git","svn_url":"https://github.com/nickbrowne/ears","homepage":"https://bixense.com/ears/ears/","size":3116,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jhasse:master","ref":"master","sha":"afd9d4a653e6040b9b3e7bebab4b035f28005180","user":{"login":"jhasse","id":80071,"avatar_url":"https://avatars2.githubusercontent.com/u/80071?v=4","gravatar_id":"","url":"https://api.github.com/users/jhasse","html_url":"https://github.com/jhasse","followers_url":"https://api.github.com/users/jhasse/followers","following_url":"https://api.github.com/users/jhasse/following{/other_user}","gists_url":"https://api.github.com/users/jhasse/gists{/gist_id}","starred_url":"https://api.github.com/users/jhasse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhasse/subscriptions","organizations_url":"https://api.github.com/users/jhasse/orgs","repos_url":"https://api.github.com/users/jhasse/repos","events_url":"https://api.github.com/users/jhasse/events{/privacy}","received_events_url":"https://api.github.com/users/jhasse/received_events","type":"User","site_admin":false},"repo":{"id":15223149,"name":"ears","full_name":"jhasse/ears","owner":{"login":"jhasse","id":80071,"avatar_url":"https://avatars2.githubusercontent.com/u/80071?v=4","gravatar_id":"","url":"https://api.github.com/users/jhasse","html_url":"https://github.com/jhasse","followers_url":"https://api.github.com/users/jhasse/followers","following_url":"https://api.github.com/users/jhasse/following{/other_user}","gists_url":"https://api.github.com/users/jhasse/gists{/gist_id}","starred_url":"https://api.github.com/users/jhasse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhasse/subscriptions","organizations_url":"https://api.github.com/users/jhasse/orgs","repos_url":"https://api.github.com/users/jhasse/repos","events_url":"https://api.github.com/users/jhasse/events{/privacy}","received_events_url":"https://api.github.com/users/jhasse/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jhasse/ears","description":"Easy Api in Rust to play Sounds","fork":true,"url":"https://api.github.com/repos/jhasse/ears","forks_url":"https://api.github.com/repos/jhasse/ears/forks","keys_url":"https://api.github.com/repos/jhasse/ears/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jhasse/ears/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jhasse/ears/teams","hooks_url":"https://api.github.com/repos/jhasse/ears/hooks","issue_events_url":"https://api.github.com/repos/jhasse/ears/issues/events{/number}","events_url":"https://api.github.com/repos/jhasse/ears/events","assignees_url":"https://api.github.com/repos/jhasse/ears/assignees{/user}","branches_url":"https://api.github.com/repos/jhasse/ears/branches{/branch}","tags_url":"https://api.github.com/repos/jhasse/ears/tags","blobs_url":"https://api.github.com/repos/jhasse/ears/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jhasse/ears/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jhasse/ears/git/refs{/sha}","trees_url":"https://api.github.com/repos/jhasse/ears/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jhasse/ears/statuses/{sha}","languages_url":"https://api.github.com/repos/jhasse/ears/languages","stargazers_url":"https://api.github.com/repos/jhasse/ears/stargazers","contributors_url":"https://api.github.com/repos/jhasse/ears/contributors","subscribers_url":"https://api.github.com/repos/jhasse/ears/subscribers","subscription_url":"https://api.github.com/repos/jhasse/ears/subscription","commits_url":"https://api.github.com/repos/jhasse/ears/commits{/sha}","git_commits_url":"https://api.github.com/repos/jhasse/ears/git/commits{/sha}","comments_url":"https://api.github.com/repos/jhasse/ears/comments{/number}","issue_comment_url":"https://api.github.com/repos/jhasse/ears/issues/comments{/number}","contents_url":"https://api.github.com/repos/jhasse/ears/contents/{+path}","compare_url":"https://api.github.com/repos/jhasse/ears/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jhasse/ears/merges","archive_url":"https://api.github.com/repos/jhasse/ears/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jhasse/ears/downloads","issues_url":"https://api.github.com/repos/jhasse/ears/issues{/number}","pulls_url":"https://api.github.com/repos/jhasse/ears/pulls{/number}","milestones_url":"https://api.github.com/repos/jhasse/ears/milestones{/number}","notifications_url":"https://api.github.com/repos/jhasse/ears/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jhasse/ears/labels{/name}","releases_url":"https://api.github.com/repos/jhasse/ears/releases{/id}","deployments_url":"https://api.github.com/repos/jhasse/ears/deployments","created_at":"2013-12-16T10:36:56Z","updated_at":"2018-03-10T18:14:45Z","pushed_at":"2018-02-25T17:19:16Z","git_url":"git://github.com/jhasse/ears.git","ssh_url":"git@github.com:jhasse/ears.git","clone_url":"https://github.com/jhasse/ears.git","svn_url":"https://github.com/jhasse/ears","homepage":"https://bixense.com/ears/ears/","size":3115,"stargazers_count":49,"watchers_count":49,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":7,"open_issues":5,"watchers":49,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jhasse/ears/pulls/18"},"html":{"href":"https://github.com/jhasse/ears/pull/18"},"issue":{"href":"https://api.github.com/repos/jhasse/ears/issues/18"},"comments":{"href":"https://api.github.com/repos/jhasse/ears/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/jhasse/ears/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/jhasse/ears/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jhasse/ears/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/jhasse/ears/statuses/59a661a848b64234bfb345d656e96ce609472c46"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":2,"additions":15,"deletions":10,"changed_files":1}}
{"actor":{"display_login":"nickbrowne"}}