{"action":"created","issue":{"url":"https://api.github.com/repos/mpv-player/mpv/issues/2695","labels_url":"https://api.github.com/repos/mpv-player/mpv/issues/2695/labels{/name}","comments_url":"https://api.github.com/repos/mpv-player/mpv/issues/2695/comments","events_url":"https://api.github.com/repos/mpv-player/mpv/issues/2695/events","html_url":"https://github.com/mpv-player/mpv/pull/2695","id":125505059,"number":2695,"title":"Fix DVB channel switching","user":{"login":"olifre","id":166759,"avatar_url":"https://avatars.githubusercontent.com/u/166759?v=3","gravatar_id":"","url":"https://api.github.com/users/olifre","html_url":"https://github.com/olifre","followers_url":"https://api.github.com/users/olifre/followers","following_url":"https://api.github.com/users/olifre/following{/other_user}","gists_url":"https://api.github.com/users/olifre/gists{/gist_id}","starred_url":"https://api.github.com/users/olifre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olifre/subscriptions","organizations_url":"https://api.github.com/users/olifre/orgs","repos_url":"https://api.github.com/users/olifre/repos","events_url":"https://api.github.com/users/olifre/events{/privacy}","received_events_url":"https://api.github.com/users/olifre/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-07T23:03:39Z","updated_at":"2016-01-08T07:16:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mpv-player/mpv/pulls/2695","html_url":"https://github.com/mpv-player/mpv/pull/2695","diff_url":"https://github.com/mpv-player/mpv/pull/2695.diff","patch_url":"https://github.com/mpv-player/mpv/pull/2695.patch"},"body":"This fixes #2568 . \r\n\r\nI am not sure this is the best solution, I am open for discussion. \r\nThe solution is two-staged: Everything related to \"state\" which should be persisted as long as DVB may be used (channel lists, current channel,. FDs etc.) is now separated into a separate state-structure. \r\nA pointer to this state-structure is persisted via a static pointer in stream_dvb. \r\nIf the state-structure exists, it is picked up during dvb_open(). \r\nIf a channel-switch is requested, the state is flagged and destruction of state will be prevented ONCE during dvbin_close(). Otherwise, state is destructed (and FDs cleaned up etc.) as usual. \r\nThis should prevent any leaks at end of process. \r\nI can confirm channel switching works again with this solution, but maybe there is a better way or place e.g. to hook up the state-destruction / persist the state, if so, I am open to change. "},"comment":{"url":"https://api.github.com/repos/mpv-player/mpv/issues/comments/169915032","html_url":"https://github.com/mpv-player/mpv/pull/2695#issuecomment-169915032","issue_url":"https://api.github.com/repos/mpv-player/mpv/issues/2695","id":169915032,"user":{"login":"wm4","id":1387750,"avatar_url":"https://avatars.githubusercontent.com/u/1387750?v=3","gravatar_id":"","url":"https://api.github.com/users/wm4","html_url":"https://github.com/wm4","followers_url":"https://api.github.com/users/wm4/followers","following_url":"https://api.github.com/users/wm4/following{/other_user}","gists_url":"https://api.github.com/users/wm4/gists{/gist_id}","starred_url":"https://api.github.com/users/wm4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wm4/subscriptions","organizations_url":"https://api.github.com/users/wm4/orgs","repos_url":"https://api.github.com/users/wm4/repos","events_url":"https://api.github.com/users/wm4/events{/privacy}","received_events_url":"https://api.github.com/users/wm4/received_events","type":"User","site_admin":false},"created_at":"2016-01-08T07:16:49Z","updated_at":"2016-01-08T07:16:49Z","body":"This looks good, except the global state bit. You need to find a way to pass this through somehow."}}