{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/smarthome/issues/2913","repository_url":"https://api.github.com/repos/eclipse/smarthome","labels_url":"https://api.github.com/repos/eclipse/smarthome/issues/2913/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/smarthome/issues/2913/comments","events_url":"https://api.github.com/repos/eclipse/smarthome/issues/2913/events","html_url":"https://github.com/eclipse/smarthome/issues/2913","id":203818005,"number":2913,"title":"MP3 AudioFormat used by URLAudioStream has an incorrect container","user":{"login":"syphr42","id":621572,"avatar_url":"https://avatars.githubusercontent.com/u/621572?v=3","gravatar_id":"","url":"https://api.github.com/users/syphr42","html_url":"https://github.com/syphr42","followers_url":"https://api.github.com/users/syphr42/followers","following_url":"https://api.github.com/users/syphr42/following{/other_user}","gists_url":"https://api.github.com/users/syphr42/gists{/gist_id}","starred_url":"https://api.github.com/users/syphr42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syphr42/subscriptions","organizations_url":"https://api.github.com/users/syphr42/orgs","repos_url":"https://api.github.com/users/syphr42/repos","events_url":"https://api.github.com/users/syphr42/events{/privacy}","received_events_url":"https://api.github.com/users/syphr42/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-01-28T17:08:16Z","updated_at":"2017-01-28T18:11:50Z","closed_at":null,"body":"AudioFormat.MP3 is defined as follows:\r\n\r\n```\r\npublic static AudioFormat MP3 = new AudioFormat(AudioFormat.CONTAINER_NONE, AudioFormat.CODEC_MP3, null, null, null,\r\n            null);\r\n```\r\n\r\nWhile URLAudioStream creates an AudioFormat defined as follows:\r\n\r\n```\r\nthis.audioFormat = new AudioFormat(AudioFormat.CODEC_MP3, AudioFormat.CODEC_MP3, false, 16, null, null);\r\n```\r\n\r\nBased on the JavaDoc for AudioFormat.CONTAINER_NONE, I believe the bug is in URLAudioStream.\r\n\r\n```\r\n    /**\r\n     * {@link AudioCodec} encoded data without any container header or footer,\r\n     * e.g. MP3 is a non-container format\r\n     */\r\n    public static final String CONTAINER_NONE = \"NONE\";\r\n```\r\n\r\nThe container on URLAudioStream's AudioFormat should be AudioFormat.CONTAINER_NONE. Due to this, AudioFormat::isCompatible(AudioFormat) does not work correctly for URLAudioStream when testing for MP3.\r\n\r\nThe fix would be this inside org.eclipse.smarthome.core.audio.URLAudioStream:\r\n\r\n```\r\nthis.audioFormat = new AudioFormat(AudioFormat.CONTAINER_NONE, AudioFormat.CODEC_MP3, false, 16, null, null);\r\n```"},"comment":{"url":"https://api.github.com/repos/eclipse/smarthome/issues/comments/275864337","html_url":"https://github.com/eclipse/smarthome/issues/2913#issuecomment-275864337","issue_url":"https://api.github.com/repos/eclipse/smarthome/issues/2913","id":275864337,"user":{"login":"syphr42","id":621572,"avatar_url":"https://avatars.githubusercontent.com/u/621572?v=3","gravatar_id":"","url":"https://api.github.com/users/syphr42","html_url":"https://github.com/syphr42","followers_url":"https://api.github.com/users/syphr42/followers","following_url":"https://api.github.com/users/syphr42/following{/other_user}","gists_url":"https://api.github.com/users/syphr42/gists{/gist_id}","starred_url":"https://api.github.com/users/syphr42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syphr42/subscriptions","organizations_url":"https://api.github.com/users/syphr42/orgs","repos_url":"https://api.github.com/users/syphr42/repos","events_url":"https://api.github.com/users/syphr42/events{/privacy}","received_events_url":"https://api.github.com/users/syphr42/received_events","type":"User","site_admin":false},"created_at":"2017-01-28T18:11:50Z","updated_at":"2017-01-28T18:11:50Z","body":"I found this while testing out a pull request to make the Squeezebox player an AudioSink (https://github.com/openhab/openhab2-addons/pull/1684). I would like to use a web-based TTS service without caching files on the hard disk since Squeezebox can simply stream the URL. However, Squeezebox needs to test for MP3 or WAV format compatibility and so the URLAudioStream is failing the compatibility test due to this bug.\r\n\r\nWhile a hack could be added to the Squeezebox code to make it work, I was hoping to get this fixed at the source. I'm putting a pull request together now."}}
{"actor":{"display_login":"syphr42"}}