{"action":"created","comment":{"url":"https://api.github.com/repos/Samsung/TizenRT/pulls/comments/239341880","pull_request_review_id":182100358,"id":239341880,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzOTM0MTg4MA==","diff_hunk":"@@ -0,0 +1,250 @@\n+/* ****************************************************************\n+ *\n+ * Copyright 2018 Samsung Electronics All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ *\n+ ******************************************************************/\n+\n+#include <tinyara/config.h>\n+#include <stdio.h>\n+#include <string.h>\n+#include <stdlib.h>\n+#include <debug.h>\n+#include <unistd.h>\n+#include <assert.h>\n+#include <media/HttpInputDataSource.h>\n+#include <chrono>\n+\n+#include \"utils/MediaUtils.h\"\n+#include \"HttpStream.h\"\n+#include \"StreamBuffer.h\"\n+#include \"StreamBufferReader.h\"\n+#include \"StreamBufferWriter.h\"\n+\n+namespace media {\n+namespace stream {\n+\n+// Content-Type for audio stream\n+static const std::string TAG_CONTENT_TYPE = \"Content-Type:\";\n+static const std::string AAC_MIME_TYPE = \"audio/aac\";\n+static const std::string AACP_MIME_TYPE = \"audio/aacp\";\n+static const std::string MPEG_MIME_TYPE = \"audio/mpeg\";\n+static const std::string OPUS_MIME_TYPE = \"audio/opus\";\n+\n+static const std::chrono::seconds WAIT_HEADER_TIMEOUT = std::chrono::seconds(3);\n+static const std::chrono::seconds WAIT_DATA_TIMEOUT = std::chrono::seconds(3);\n+\n+HttpInputDataSource::HttpInputDataSource(const std::string &url)\n+\t: InputDataSource(), mUrl(url)\n+{\n+\tmedvdbg(\"url: %s\\n\", mUrl.c_str());\n+}\n+\n+HttpInputDataSource::HttpInputDataSource(const HttpInputDataSource &source)\n+\t: InputDataSource(source), mUrl(source.mUrl)\n+{\n+}\n+\n+HttpInputDataSource &HttpInputDataSource::operator=(const HttpInputDataSource &source)\n+{\n+\tInputDataSource::operator=(source);\n+\treturn *this;\n+}\n+\n+bool HttpInputDataSource::open()\n+{\n+\tmedvdbg(\"HttpInputDataSource::open!\\n\");\n+\t// create stream buffer to cache downloading data\n+\tmStreamBuffer = StreamBuffer::Builder()\n+\t\t\t\t\t\t\t.setBufferSize(4096)\n+\t\t\t\t\t\t\t.setThreshold(2048)\n+\t\t\t\t\t\t\t.build();\n+\tif (!mStreamBuffer) {\n+\t\tmeddbg(\"mStreamBuffer is nullptr!\\n\");\n+\t\treturn false;\n+\t}\n+\n+\tmBufferReader = std::make_shared<StreamBufferReader>(mStreamBuffer);\n+\tmBufferWriter = std::make_shared<StreamBufferWriter>(mStreamBuffer);\n+\n+\tmHttpStream = HttpStream::create();\n+\tif (!mHttpStream) {\n+\t\tmeddbg(\"mHttpStream is nullptr!\\n\");\n+\t\treturn false;\n+\t}\n+\n+\tstd::unique_lock<std::mutex> lock(mMutex);\n+\tmIsHeaderReceived = false;\n+\tmIsDataReceived = false;\n+\n+\tmThread = std::thread([this]() {\n+\t\tmedvdbg(\"download thread enter!\\n\");\n+\t\t//mHttpStream->addHeader(\"Icy-MetaData:1\"); // not support now\n+\t\tmHttpStream->setHeaderCallback(HeaderCallback, (void *)this);\n+\t\tmHttpStream->setWriteCallback(WriteCallback, (void *)this);\n+\t\tif (!mHttpStream->download(mUrl)) {\n+\t\t\tmedwdbg(\"download failed or terminated!\\n\");","path":"framework/src/media/HttpInputDataSource.cpp","position":117,"original_position":97,"commit_id":"4d0f57f63016d131f9bf6235b40bec44f19608e4","original_commit_id":"f7158e4584b71382004a29ae028beed9f445dae1","user":{"login":"Taejun-Kwon","id":25811447,"node_id":"MDQ6VXNlcjI1ODExNDQ3","avatar_url":"https://avatars1.githubusercontent.com/u/25811447?v=4","gravatar_id":"","url":"https://api.github.com/users/Taejun-Kwon","html_url":"https://github.com/Taejun-Kwon","followers_url":"https://api.github.com/users/Taejun-Kwon/followers","following_url":"https://api.github.com/users/Taejun-Kwon/following{/other_user}","gists_url":"https://api.github.com/users/Taejun-Kwon/gists{/gist_id}","starred_url":"https://api.github.com/users/Taejun-Kwon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Taejun-Kwon/subscriptions","organizations_url":"https://api.github.com/users/Taejun-Kwon/orgs","repos_url":"https://api.github.com/users/Taejun-Kwon/repos","events_url":"https://api.github.com/users/Taejun-Kwon/events{/privacy}","received_events_url":"https://api.github.com/users/Taejun-Kwon/received_events","type":"User","site_admin":false},"body":"std::thread using fixed size of stack, (as I know 1024) is it enough?","created_at":"2018-12-06T06:39:29Z","updated_at":"2018-12-06T06:39:29Z","html_url":"https://github.com/Samsung/TizenRT/pull/2429#discussion_r239341880","pull_request_url":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Samsung/TizenRT/pulls/comments/239341880"},"html":{"href":"https://github.com/Samsung/TizenRT/pull/2429#discussion_r239341880"},"pull_request":{"href":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429"}},"in_reply_to_id":231826368},"pull_request":{"url":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429","id":228650903,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI4NjUwOTAz","html_url":"https://github.com/Samsung/TizenRT/pull/2429","diff_url":"https://github.com/Samsung/TizenRT/pull/2429.diff","patch_url":"https://github.com/Samsung/TizenRT/pull/2429.patch","issue_url":"https://api.github.com/repos/Samsung/TizenRT/issues/2429","number":2429,"state":"open","locked":false,"title":"framework/media: Add HttpInputDataSource for internet audio stream","user":{"login":"zhouxinhe","id":38490562,"node_id":"MDQ6VXNlcjM4NDkwNTYy","avatar_url":"https://avatars2.githubusercontent.com/u/38490562?v=4","gravatar_id":"","url":"https://api.github.com/users/zhouxinhe","html_url":"https://github.com/zhouxinhe","followers_url":"https://api.github.com/users/zhouxinhe/followers","following_url":"https://api.github.com/users/zhouxinhe/following{/other_user}","gists_url":"https://api.github.com/users/zhouxinhe/gists{/gist_id}","starred_url":"https://api.github.com/users/zhouxinhe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhouxinhe/subscriptions","organizations_url":"https://api.github.com/users/zhouxinhe/orgs","repos_url":"https://api.github.com/users/zhouxinhe/repos","events_url":"https://api.github.com/users/zhouxinhe/events{/privacy}","received_events_url":"https://api.github.com/users/zhouxinhe/received_events","type":"User","site_admin":false},"body":"1. Add http stream class to download/upload audio stream, basing on libcurl.\r\n2. Add HttpInputDataSource support mp3 and aac type audio stream,\r\n    It requests that there always be content-type in http headers.\r\n3. Add new API  in StreamBuffer, it's used in HttpInputDataSource.\r\n4. Update mediaplayer example app for HttpInputDataSource test.\r\n@Taejun-Kwon @gcjjyy ","created_at":"2018-11-06T10:58:29Z","updated_at":"2018-12-06T06:39:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b22d5a6de618d590d73cdbd544068fd3550cc017","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429/commits","review_comments_url":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429/comments","review_comment_url":"https://api.github.com/repos/Samsung/TizenRT/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Samsung/TizenRT/issues/2429/comments","statuses_url":"https://api.github.com/repos/Samsung/TizenRT/statuses/4d0f57f63016d131f9bf6235b40bec44f19608e4","head":{"label":"zhouxinhe:http-source","ref":"http-source","sha":"4d0f57f63016d131f9bf6235b40bec44f19608e4","user":{"login":"zhouxinhe","id":38490562,"node_id":"MDQ6VXNlcjM4NDkwNTYy","avatar_url":"https://avatars2.githubusercontent.com/u/38490562?v=4","gravatar_id":"","url":"https://api.github.com/users/zhouxinhe","html_url":"https://github.com/zhouxinhe","followers_url":"https://api.github.com/users/zhouxinhe/followers","following_url":"https://api.github.com/users/zhouxinhe/following{/other_user}","gists_url":"https://api.github.com/users/zhouxinhe/gists{/gist_id}","starred_url":"https://api.github.com/users/zhouxinhe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhouxinhe/subscriptions","organizations_url":"https://api.github.com/users/zhouxinhe/orgs","repos_url":"https://api.github.com/users/zhouxinhe/repos","events_url":"https://api.github.com/users/zhouxinhe/events{/privacy}","received_events_url":"https://api.github.com/users/zhouxinhe/received_events","type":"User","site_admin":false},"repo":{"id":139673965,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk2NzM5NjU=","name":"TizenRT","full_name":"zhouxinhe/TizenRT","private":false,"owner":{"login":"zhouxinhe","id":38490562,"node_id":"MDQ6VXNlcjM4NDkwNTYy","avatar_url":"https://avatars2.githubusercontent.com/u/38490562?v=4","gravatar_id":"","url":"https://api.github.com/users/zhouxinhe","html_url":"https://github.com/zhouxinhe","followers_url":"https://api.github.com/users/zhouxinhe/followers","following_url":"https://api.github.com/users/zhouxinhe/following{/other_user}","gists_url":"https://api.github.com/users/zhouxinhe/gists{/gist_id}","starred_url":"https://api.github.com/users/zhouxinhe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhouxinhe/subscriptions","organizations_url":"https://api.github.com/users/zhouxinhe/orgs","repos_url":"https://api.github.com/users/zhouxinhe/repos","events_url":"https://api.github.com/users/zhouxinhe/events{/privacy}","received_events_url":"https://api.github.com/users/zhouxinhe/received_events","type":"User","site_admin":false},"html_url":"https://github.com/zhouxinhe/TizenRT","description":"TizenRT is a lightweight RTOS-based platform to support low-end IoT devices","fork":true,"url":"https://api.github.com/repos/zhouxinhe/TizenRT","forks_url":"https://api.github.com/repos/zhouxinhe/TizenRT/forks","keys_url":"https://api.github.com/repos/zhouxinhe/TizenRT/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zhouxinhe/TizenRT/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zhouxinhe/TizenRT/teams","hooks_url":"https://api.github.com/repos/zhouxinhe/TizenRT/hooks","issue_events_url":"https://api.github.com/repos/zhouxinhe/TizenRT/issues/events{/number}","events_url":"https://api.github.com/repos/zhouxinhe/TizenRT/events","assignees_url":"https://api.github.com/repos/zhouxinhe/TizenRT/assignees{/user}","branches_url":"https://api.github.com/repos/zhouxinhe/TizenRT/branches{/branch}","tags_url":"https://api.github.com/repos/zhouxinhe/TizenRT/tags","blobs_url":"https://api.github.com/repos/zhouxinhe/TizenRT/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zhouxinhe/TizenRT/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zhouxinhe/TizenRT/git/refs{/sha}","trees_url":"https://api.github.com/repos/zhouxinhe/TizenRT/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zhouxinhe/TizenRT/statuses/{sha}","languages_url":"https://api.github.com/repos/zhouxinhe/TizenRT/languages","stargazers_url":"https://api.github.com/repos/zhouxinhe/TizenRT/stargazers","contributors_url":"https://api.github.com/repos/zhouxinhe/TizenRT/contributors","subscribers_url":"https://api.github.com/repos/zhouxinhe/TizenRT/subscribers","subscription_url":"https://api.github.com/repos/zhouxinhe/TizenRT/subscription","commits_url":"https://api.github.com/repos/zhouxinhe/TizenRT/commits{/sha}","git_commits_url":"https://api.github.com/repos/zhouxinhe/TizenRT/git/commits{/sha}","comments_url":"https://api.github.com/repos/zhouxinhe/TizenRT/comments{/number}","issue_comment_url":"https://api.github.com/repos/zhouxinhe/TizenRT/issues/comments{/number}","contents_url":"https://api.github.com/repos/zhouxinhe/TizenRT/contents/{+path}","compare_url":"https://api.github.com/repos/zhouxinhe/TizenRT/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zhouxinhe/TizenRT/merges","archive_url":"https://api.github.com/repos/zhouxinhe/TizenRT/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zhouxinhe/TizenRT/downloads","issues_url":"https://api.github.com/repos/zhouxinhe/TizenRT/issues{/number}","pulls_url":"https://api.github.com/repos/zhouxinhe/TizenRT/pulls{/number}","milestones_url":"https://api.github.com/repos/zhouxinhe/TizenRT/milestones{/number}","notifications_url":"https://api.github.com/repos/zhouxinhe/TizenRT/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zhouxinhe/TizenRT/labels{/name}","releases_url":"https://api.github.com/repos/zhouxinhe/TizenRT/releases{/id}","deployments_url":"https://api.github.com/repos/zhouxinhe/TizenRT/deployments","created_at":"2018-07-04T05:47:07Z","updated_at":"2018-10-29T07:55:03Z","pushed_at":"2018-12-04T08:53:06Z","git_url":"git://github.com/zhouxinhe/TizenRT.git","ssh_url":"git@github.com:zhouxinhe/TizenRT.git","clone_url":"https://github.com/zhouxinhe/TizenRT.git","svn_url":"https://github.com/zhouxinhe/TizenRT","homepage":"","size":107187,"stargazers_count":0,"watchers_count":0,"language":"C","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":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Samsung:master","ref":"master","sha":"88d38ba19c044f456f4530b6a19476bec8e31291","user":{"login":"Samsung","id":6210390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyMTAzOTA=","avatar_url":"https://avatars3.githubusercontent.com/u/6210390?v=4","gravatar_id":"","url":"https://api.github.com/users/Samsung","html_url":"https://github.com/Samsung","followers_url":"https://api.github.com/users/Samsung/followers","following_url":"https://api.github.com/users/Samsung/following{/other_user}","gists_url":"https://api.github.com/users/Samsung/gists{/gist_id}","starred_url":"https://api.github.com/users/Samsung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Samsung/subscriptions","organizations_url":"https://api.github.com/users/Samsung/orgs","repos_url":"https://api.github.com/users/Samsung/repos","events_url":"https://api.github.com/users/Samsung/events{/privacy}","received_events_url":"https://api.github.com/users/Samsung/received_events","type":"Organization","site_admin":false},"repo":{"id":82517252,"node_id":"MDEwOlJlcG9zaXRvcnk4MjUxNzI1Mg==","name":"TizenRT","full_name":"Samsung/TizenRT","private":false,"owner":{"login":"Samsung","id":6210390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyMTAzOTA=","avatar_url":"https://avatars3.githubusercontent.com/u/6210390?v=4","gravatar_id":"","url":"https://api.github.com/users/Samsung","html_url":"https://github.com/Samsung","followers_url":"https://api.github.com/users/Samsung/followers","following_url":"https://api.github.com/users/Samsung/following{/other_user}","gists_url":"https://api.github.com/users/Samsung/gists{/gist_id}","starred_url":"https://api.github.com/users/Samsung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Samsung/subscriptions","organizations_url":"https://api.github.com/users/Samsung/orgs","repos_url":"https://api.github.com/users/Samsung/repos","events_url":"https://api.github.com/users/Samsung/events{/privacy}","received_events_url":"https://api.github.com/users/Samsung/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Samsung/TizenRT","description":"TizenRT is a lightweight RTOS-based platform to support low-end IoT devices","fork":false,"url":"https://api.github.com/repos/Samsung/TizenRT","forks_url":"https://api.github.com/repos/Samsung/TizenRT/forks","keys_url":"https://api.github.com/repos/Samsung/TizenRT/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Samsung/TizenRT/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Samsung/TizenRT/teams","hooks_url":"https://api.github.com/repos/Samsung/TizenRT/hooks","issue_events_url":"https://api.github.com/repos/Samsung/TizenRT/issues/events{/number}","events_url":"https://api.github.com/repos/Samsung/TizenRT/events","assignees_url":"https://api.github.com/repos/Samsung/TizenRT/assignees{/user}","branches_url":"https://api.github.com/repos/Samsung/TizenRT/branches{/branch}","tags_url":"https://api.github.com/repos/Samsung/TizenRT/tags","blobs_url":"https://api.github.com/repos/Samsung/TizenRT/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Samsung/TizenRT/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Samsung/TizenRT/git/refs{/sha}","trees_url":"https://api.github.com/repos/Samsung/TizenRT/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Samsung/TizenRT/statuses/{sha}","languages_url":"https://api.github.com/repos/Samsung/TizenRT/languages","stargazers_url":"https://api.github.com/repos/Samsung/TizenRT/stargazers","contributors_url":"https://api.github.com/repos/Samsung/TizenRT/contributors","subscribers_url":"https://api.github.com/repos/Samsung/TizenRT/subscribers","subscription_url":"https://api.github.com/repos/Samsung/TizenRT/subscription","commits_url":"https://api.github.com/repos/Samsung/TizenRT/commits{/sha}","git_commits_url":"https://api.github.com/repos/Samsung/TizenRT/git/commits{/sha}","comments_url":"https://api.github.com/repos/Samsung/TizenRT/comments{/number}","issue_comment_url":"https://api.github.com/repos/Samsung/TizenRT/issues/comments{/number}","contents_url":"https://api.github.com/repos/Samsung/TizenRT/contents/{+path}","compare_url":"https://api.github.com/repos/Samsung/TizenRT/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Samsung/TizenRT/merges","archive_url":"https://api.github.com/repos/Samsung/TizenRT/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Samsung/TizenRT/downloads","issues_url":"https://api.github.com/repos/Samsung/TizenRT/issues{/number}","pulls_url":"https://api.github.com/repos/Samsung/TizenRT/pulls{/number}","milestones_url":"https://api.github.com/repos/Samsung/TizenRT/milestones{/number}","notifications_url":"https://api.github.com/repos/Samsung/TizenRT/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Samsung/TizenRT/labels{/name}","releases_url":"https://api.github.com/repos/Samsung/TizenRT/releases{/id}","deployments_url":"https://api.github.com/repos/Samsung/TizenRT/deployments","created_at":"2017-02-20T04:38:30Z","updated_at":"2018-12-06T05:55:46Z","pushed_at":"2018-12-06T05:55:38Z","git_url":"git://github.com/Samsung/TizenRT.git","ssh_url":"git@github.com:Samsung/TizenRT.git","clone_url":"https://github.com/Samsung/TizenRT.git","svn_url":"https://github.com/Samsung/TizenRT","homepage":"","size":107247,"stargazers_count":214,"watchers_count":214,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":372,"mirror_url":null,"archived":false,"open_issues_count":64,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":372,"open_issues":64,"watchers":214,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429"},"html":{"href":"https://github.com/Samsung/TizenRT/pull/2429"},"issue":{"href":"https://api.github.com/repos/Samsung/TizenRT/issues/2429"},"comments":{"href":"https://api.github.com/repos/Samsung/TizenRT/issues/2429/comments"},"review_comments":{"href":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429/comments"},"review_comment":{"href":"https://api.github.com/repos/Samsung/TizenRT/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429/commits"},"statuses":{"href":"https://api.github.com/repos/Samsung/TizenRT/statuses/4d0f57f63016d131f9bf6235b40bec44f19608e4"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Taejun-Kwon"}}