{"action":"created","comment":{"url":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls/comments/140268925","pull_request_review_id":64316703,"id":140268925,"diff_hunk":"@@ -3768,27 +3808,113 @@ public Surface createOpenGLInputSurface(int frameRate, int iFrameInterval, int w\n         SdlConnection sdlConn = sdlSession.getSdlConnection();\r\n         if (sdlConn == null) return null;\r\n         \r\n-        navServiceStartResponseReceived = false;\r\n-        navServiceStartResponse = false;\r\n-        sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);\r\n-        \r\n-        FutureTask<Void> fTask =  createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));\r\n-        ScheduledExecutorService scheduler = createScheduler();\r\n-        scheduler.execute(fTask);\r\n-        \r\n-        while (!navServiceStartResponseReceived && !fTask.isDone());\r\n-        scheduler.shutdown();\r\n-        scheduler = null;\r\n-        fTask = null;\r\n-        \r\n-        if (navServiceStartResponse) {\r\n-            return sdlSession.createOpenGLInputSurface(frameRate, iFrameInterval, width,\r\n-                                                    height, bitrate, SessionType.NAV, sdlSession.getSessionId());\r\n-        } else {\r\n-            return null;\r\n+        VideoStreamingFormat[] availableFormats = { VIDEO_STREAMING_FORMAT_H264_RTP, VIDEO_STREAMING_FORMAT_H264_RAW };\r\n+        List<VideoStreamingParams> desiredParamsList = createDesiredVideoParams(\r\n+                _videoStreamingCapabilities, frameRate, iFrameInterval, width, height, bitrate, availableFormats);\r\n+\r\n+        // if none of video formats are accepted, try StartService without parameter at last\r\n+        VideoStreamingParams emptyParam = new VideoStreamingParams();\r\n+        emptyParam.setResolution(null);\r\n+        emptyParam.setFormat(null);\r\n+        desiredParamsList.add(emptyParam);\r\n+\r\n+        for (VideoStreamingParams params : desiredParamsList) {\r\n+            sdlSession.setDesiredVideoParams(params);\r\n+\r\n+            navServiceStartResponseReceived = false;\r\n+            navServiceStartResponse = false;\r\n+            navServiceStartRejectedParams = null;\r\n+\r\n+            sdlSession.startService(SessionType.NAV, sdlSession.getSessionId(), isEncrypted);\r\n+\r\n+            FutureTask<Void> fTask =  createFutureTask(new CallableMethod(RESPONSE_WAIT_TIME));\r\n+            ScheduledExecutorService scheduler = createScheduler();\r\n+            scheduler.execute(fTask);\r\n+\r\n+            while (!navServiceStartResponseReceived && !fTask.isDone());\r\n+            scheduler.shutdown();\r\n+            scheduler = null;\r\n+            fTask = null;\r\n+\r\n+            if (navServiceStartResponse) {\r\n+                return sdlSession.createOpenGLInputSurface(frameRate, iFrameInterval, width,\r\n+                        height, bitrate, SessionType.NAV, sdlSession.getSessionId());\r\n+            }\r\n+\r\n+            if (navServiceStartRejectedParams != null) {\r\n+                StringBuilder builder = new StringBuilder();\r\n+                for (String paramName : navServiceStartRejectedParams) {\r\n+                    if (builder.length() > 0) {\r\n+                        builder.append(\", \");\r\n+                    }\r\n+                    builder.append(paramName);\r\n+                }\r\n+                DebugTool.logWarning(\"StartService for nav failed. Rejected params: \" + builder.toString());\r\n+\r\n+                if (!navServiceStartRejectedParams.contains(ControlFrameTags.Video.StartService.VIDEO_PROTOCOL)\r\n+                        && !navServiceStartRejectedParams.contains(ControlFrameTags.Video.StartService.VIDEO_CODEC)) {\r\n+                    // The reason of NACK is not protocol nor codec. There is no point retrying with\r\n+                    // another video format, so we simply fail here.\r\n+                    break;\r\n+                }\r\n+            } else {\r\n+                DebugTool.logWarning(\"StartService for nav failed (rejected params not supplied)\");\r\n+            }\r\n         }\r\n+        return null;\r\n     }\r\n-    \r\n+\r\n+    /**\r\n+     * Creates a list of VideoStreamingParams with video formats that are supported by both HMI and proxy\r\n+     *\r\n+     * Note: this method does not take care of matching video resolution. App should look into\r\n+     * HMI capability's preferredResolution and adjust width and height accordingly.\r\n+     *\r\n+     * @param hmiCapability HMI's capability information\r\n+     * @param frameRate specified rate of frames\r\n+     * @param frameInterval specified interval\r\n+     * @param width specified width of the video\r\n+     * @param height specified height of the video\r\n+     * @param bitrate specified bitrate of the video\r\n+     * @param availableFormats list of video formats supported by proxy\r\n+     * @return list of VideoStreamingParams instance. This list can be empty.\r\n+     */\r\n+    private static List<VideoStreamingParams> createDesiredVideoParams(\r\n+            VideoStreamingCapability hmiCapability,\r\n+            int frameRate, int frameInterval, int width, int height, int bitrate,\r\n+            VideoStreamingFormat[] availableFormats) {\r\n+        ArrayList<VideoStreamingFormat> formats = new ArrayList<>();\r\n+        if (hmiCapability != null && hmiCapability.getSupportedFormats() != null\r\n+                && availableFormats != null) {\r\n+            // supportedFormat is listed in HMI's preferred order\r\n+            for (VideoStreamingFormat supportedFormat : hmiCapability.getSupportedFormats()) {\r","path":"sdl_android/src/main/java/com/smartdevicelink/proxy/SdlProxyBase.java","position":241,"original_position":241,"commit_id":"c13f727234e67fd5f6d377bdba53c70474cbb0e2","original_commit_id":"c13f727234e67fd5f6d377bdba53c70474cbb0e2","user":{"login":"brettywhite","id":3911458,"avatar_url":"https://avatars0.githubusercontent.com/u/3911458?v=4","gravatar_id":"","url":"https://api.github.com/users/brettywhite","html_url":"https://github.com/brettywhite","followers_url":"https://api.github.com/users/brettywhite/followers","following_url":"https://api.github.com/users/brettywhite/following{/other_user}","gists_url":"https://api.github.com/users/brettywhite/gists{/gist_id}","starred_url":"https://api.github.com/users/brettywhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettywhite/subscriptions","organizations_url":"https://api.github.com/users/brettywhite/orgs","repos_url":"https://api.github.com/users/brettywhite/repos","events_url":"https://api.github.com/users/brettywhite/events{/privacy}","received_events_url":"https://api.github.com/users/brettywhite/received_events","type":"User","site_admin":false},"body":"@shoamano83 We were able to confirm that it works as you described. Thank you for your help","created_at":"2017-09-21T15:03:46Z","updated_at":"2017-09-21T15:03:46Z","html_url":"https://github.com/smartdevicelink/sdl_android/pull/592#discussion_r140268925","pull_request_url":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls/592","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls/comments/140268925"},"html":{"href":"https://github.com/smartdevicelink/sdl_android/pull/592#discussion_r140268925"},"pull_request":{"href":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls/592"}},"in_reply_to_id":139160076},"pull_request":{"url":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls/592","id":137160624,"html_url":"https://github.com/smartdevicelink/sdl_android/pull/592","diff_url":"https://github.com/smartdevicelink/sdl_android/pull/592.diff","patch_url":"https://github.com/smartdevicelink/sdl_android/pull/592.patch","issue_url":"https://api.github.com/repos/smartdevicelink/sdl_android/issues/592","number":592,"state":"open","locked":false,"title":"Feature/issue 515 rtp packetizer","user":{"login":"shoamano83","id":26382896,"avatar_url":"https://avatars1.githubusercontent.com/u/26382896?v=4","gravatar_id":"","url":"https://api.github.com/users/shoamano83","html_url":"https://github.com/shoamano83","followers_url":"https://api.github.com/users/shoamano83/followers","following_url":"https://api.github.com/users/shoamano83/following{/other_user}","gists_url":"https://api.github.com/users/shoamano83/gists{/gist_id}","starred_url":"https://api.github.com/users/shoamano83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoamano83/subscriptions","organizations_url":"https://api.github.com/users/shoamano83/orgs","repos_url":"https://api.github.com/users/shoamano83/repos","events_url":"https://api.github.com/users/shoamano83/events{/privacy}","received_events_url":"https://api.github.com/users/shoamano83/received_events","type":"User","site_admin":false},"body":"This PR is related to issue https://github.com/smartdevicelink/sdl_android/issues/515\r\nThis PR is **ready** for review.\r\n\r\n## Summary\r\n\r\nThis PR adds RTP packetizer implementation which is necessary for SDL-0048.\r\nAlso it includes small additions to encoder's output (IEncoderListener) and ProtocolMessage.setData() which are necessary for RTP output.\r\n\r\n## Risk\r\n\r\nThis PR does not make changes in Mobile_API.\r\nThe RTP packetizer is not enabled yet and this PR should not make changes in existing flow.\r\nTherefore I think the risk is low.\r\n\r\n## Testing Plan\r\n\r\nUnit test cases are added for the new packetizer.\r\n\r\n## Note\r\n\r\nThe RTP implementation is NOT enabled yet. We need video format selection mechanism to enable the new format, and it depends on Video Streaming Capabilities and Constructed Payload implementations.\r\n\r\nI created this PR before seeing the implementations on develop branch so that we can work on the implementations and code review in parallel.\r\n\r\nBy the way, please let me know if I should also work on the switching mechanism after implementations of Video Streaming Capabilities and Constructed Payload are done.\r\n\r\nThanks.","created_at":"2017-08-23T08:41:42Z","updated_at":"2017-09-21T15:03:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3df042630840baef84de45ca629ad8c899570735","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls/592/commits","review_comments_url":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls/592/comments","review_comment_url":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/smartdevicelink/sdl_android/issues/592/comments","statuses_url":"https://api.github.com/repos/smartdevicelink/sdl_android/statuses/c13f727234e67fd5f6d377bdba53c70474cbb0e2","head":{"label":"shoamano83:feature/issue_515_rtp_packetizer","ref":"feature/issue_515_rtp_packetizer","sha":"c13f727234e67fd5f6d377bdba53c70474cbb0e2","user":{"login":"shoamano83","id":26382896,"avatar_url":"https://avatars1.githubusercontent.com/u/26382896?v=4","gravatar_id":"","url":"https://api.github.com/users/shoamano83","html_url":"https://github.com/shoamano83","followers_url":"https://api.github.com/users/shoamano83/followers","following_url":"https://api.github.com/users/shoamano83/following{/other_user}","gists_url":"https://api.github.com/users/shoamano83/gists{/gist_id}","starred_url":"https://api.github.com/users/shoamano83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoamano83/subscriptions","organizations_url":"https://api.github.com/users/shoamano83/orgs","repos_url":"https://api.github.com/users/shoamano83/repos","events_url":"https://api.github.com/users/shoamano83/events{/privacy}","received_events_url":"https://api.github.com/users/shoamano83/received_events","type":"User","site_admin":false},"repo":{"id":84920002,"name":"sdl_android","full_name":"shoamano83/sdl_android","owner":{"login":"shoamano83","id":26382896,"avatar_url":"https://avatars1.githubusercontent.com/u/26382896?v=4","gravatar_id":"","url":"https://api.github.com/users/shoamano83","html_url":"https://github.com/shoamano83","followers_url":"https://api.github.com/users/shoamano83/followers","following_url":"https://api.github.com/users/shoamano83/following{/other_user}","gists_url":"https://api.github.com/users/shoamano83/gists{/gist_id}","starred_url":"https://api.github.com/users/shoamano83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoamano83/subscriptions","organizations_url":"https://api.github.com/users/shoamano83/orgs","repos_url":"https://api.github.com/users/shoamano83/repos","events_url":"https://api.github.com/users/shoamano83/events{/privacy}","received_events_url":"https://api.github.com/users/shoamano83/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shoamano83/sdl_android","description":"SmartDeviceLink mobile library for Android","fork":true,"url":"https://api.github.com/repos/shoamano83/sdl_android","forks_url":"https://api.github.com/repos/shoamano83/sdl_android/forks","keys_url":"https://api.github.com/repos/shoamano83/sdl_android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shoamano83/sdl_android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shoamano83/sdl_android/teams","hooks_url":"https://api.github.com/repos/shoamano83/sdl_android/hooks","issue_events_url":"https://api.github.com/repos/shoamano83/sdl_android/issues/events{/number}","events_url":"https://api.github.com/repos/shoamano83/sdl_android/events","assignees_url":"https://api.github.com/repos/shoamano83/sdl_android/assignees{/user}","branches_url":"https://api.github.com/repos/shoamano83/sdl_android/branches{/branch}","tags_url":"https://api.github.com/repos/shoamano83/sdl_android/tags","blobs_url":"https://api.github.com/repos/shoamano83/sdl_android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shoamano83/sdl_android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shoamano83/sdl_android/git/refs{/sha}","trees_url":"https://api.github.com/repos/shoamano83/sdl_android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shoamano83/sdl_android/statuses/{sha}","languages_url":"https://api.github.com/repos/shoamano83/sdl_android/languages","stargazers_url":"https://api.github.com/repos/shoamano83/sdl_android/stargazers","contributors_url":"https://api.github.com/repos/shoamano83/sdl_android/contributors","subscribers_url":"https://api.github.com/repos/shoamano83/sdl_android/subscribers","subscription_url":"https://api.github.com/repos/shoamano83/sdl_android/subscription","commits_url":"https://api.github.com/repos/shoamano83/sdl_android/commits{/sha}","git_commits_url":"https://api.github.com/repos/shoamano83/sdl_android/git/commits{/sha}","comments_url":"https://api.github.com/repos/shoamano83/sdl_android/comments{/number}","issue_comment_url":"https://api.github.com/repos/shoamano83/sdl_android/issues/comments{/number}","contents_url":"https://api.github.com/repos/shoamano83/sdl_android/contents/{+path}","compare_url":"https://api.github.com/repos/shoamano83/sdl_android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shoamano83/sdl_android/merges","archive_url":"https://api.github.com/repos/shoamano83/sdl_android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shoamano83/sdl_android/downloads","issues_url":"https://api.github.com/repos/shoamano83/sdl_android/issues{/number}","pulls_url":"https://api.github.com/repos/shoamano83/sdl_android/pulls{/number}","milestones_url":"https://api.github.com/repos/shoamano83/sdl_android/milestones{/number}","notifications_url":"https://api.github.com/repos/shoamano83/sdl_android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shoamano83/sdl_android/labels{/name}","releases_url":"https://api.github.com/repos/shoamano83/sdl_android/releases{/id}","deployments_url":"https://api.github.com/repos/shoamano83/sdl_android/deployments","created_at":"2017-03-14T07:41:53Z","updated_at":"2017-03-14T07:41:56Z","pushed_at":"2017-09-14T01:39:33Z","git_url":"git://github.com/shoamano83/sdl_android.git","ssh_url":"git@github.com:shoamano83/sdl_android.git","clone_url":"https://github.com/shoamano83/sdl_android.git","svn_url":"https://github.com/shoamano83/sdl_android","homepage":"","size":8965,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"smartdevicelink:develop","ref":"develop","sha":"78e5e70ecc4f69d54a1f59f8d11230fb325094eb","user":{"login":"smartdevicelink","id":8671397,"avatar_url":"https://avatars3.githubusercontent.com/u/8671397?v=4","gravatar_id":"","url":"https://api.github.com/users/smartdevicelink","html_url":"https://github.com/smartdevicelink","followers_url":"https://api.github.com/users/smartdevicelink/followers","following_url":"https://api.github.com/users/smartdevicelink/following{/other_user}","gists_url":"https://api.github.com/users/smartdevicelink/gists{/gist_id}","starred_url":"https://api.github.com/users/smartdevicelink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smartdevicelink/subscriptions","organizations_url":"https://api.github.com/users/smartdevicelink/orgs","repos_url":"https://api.github.com/users/smartdevicelink/repos","events_url":"https://api.github.com/users/smartdevicelink/events{/privacy}","received_events_url":"https://api.github.com/users/smartdevicelink/received_events","type":"Organization","site_admin":false},"repo":{"id":24610319,"name":"sdl_android","full_name":"smartdevicelink/sdl_android","owner":{"login":"smartdevicelink","id":8671397,"avatar_url":"https://avatars3.githubusercontent.com/u/8671397?v=4","gravatar_id":"","url":"https://api.github.com/users/smartdevicelink","html_url":"https://github.com/smartdevicelink","followers_url":"https://api.github.com/users/smartdevicelink/followers","following_url":"https://api.github.com/users/smartdevicelink/following{/other_user}","gists_url":"https://api.github.com/users/smartdevicelink/gists{/gist_id}","starred_url":"https://api.github.com/users/smartdevicelink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smartdevicelink/subscriptions","organizations_url":"https://api.github.com/users/smartdevicelink/orgs","repos_url":"https://api.github.com/users/smartdevicelink/repos","events_url":"https://api.github.com/users/smartdevicelink/events{/privacy}","received_events_url":"https://api.github.com/users/smartdevicelink/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/smartdevicelink/sdl_android","description":"SmartDeviceLink mobile library for Android","fork":false,"url":"https://api.github.com/repos/smartdevicelink/sdl_android","forks_url":"https://api.github.com/repos/smartdevicelink/sdl_android/forks","keys_url":"https://api.github.com/repos/smartdevicelink/sdl_android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/smartdevicelink/sdl_android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/smartdevicelink/sdl_android/teams","hooks_url":"https://api.github.com/repos/smartdevicelink/sdl_android/hooks","issue_events_url":"https://api.github.com/repos/smartdevicelink/sdl_android/issues/events{/number}","events_url":"https://api.github.com/repos/smartdevicelink/sdl_android/events","assignees_url":"https://api.github.com/repos/smartdevicelink/sdl_android/assignees{/user}","branches_url":"https://api.github.com/repos/smartdevicelink/sdl_android/branches{/branch}","tags_url":"https://api.github.com/repos/smartdevicelink/sdl_android/tags","blobs_url":"https://api.github.com/repos/smartdevicelink/sdl_android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/smartdevicelink/sdl_android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/smartdevicelink/sdl_android/git/refs{/sha}","trees_url":"https://api.github.com/repos/smartdevicelink/sdl_android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/smartdevicelink/sdl_android/statuses/{sha}","languages_url":"https://api.github.com/repos/smartdevicelink/sdl_android/languages","stargazers_url":"https://api.github.com/repos/smartdevicelink/sdl_android/stargazers","contributors_url":"https://api.github.com/repos/smartdevicelink/sdl_android/contributors","subscribers_url":"https://api.github.com/repos/smartdevicelink/sdl_android/subscribers","subscription_url":"https://api.github.com/repos/smartdevicelink/sdl_android/subscription","commits_url":"https://api.github.com/repos/smartdevicelink/sdl_android/commits{/sha}","git_commits_url":"https://api.github.com/repos/smartdevicelink/sdl_android/git/commits{/sha}","comments_url":"https://api.github.com/repos/smartdevicelink/sdl_android/comments{/number}","issue_comment_url":"https://api.github.com/repos/smartdevicelink/sdl_android/issues/comments{/number}","contents_url":"https://api.github.com/repos/smartdevicelink/sdl_android/contents/{+path}","compare_url":"https://api.github.com/repos/smartdevicelink/sdl_android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/smartdevicelink/sdl_android/merges","archive_url":"https://api.github.com/repos/smartdevicelink/sdl_android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/smartdevicelink/sdl_android/downloads","issues_url":"https://api.github.com/repos/smartdevicelink/sdl_android/issues{/number}","pulls_url":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls{/number}","milestones_url":"https://api.github.com/repos/smartdevicelink/sdl_android/milestones{/number}","notifications_url":"https://api.github.com/repos/smartdevicelink/sdl_android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/smartdevicelink/sdl_android/labels{/name}","releases_url":"https://api.github.com/repos/smartdevicelink/sdl_android/releases{/id}","deployments_url":"https://api.github.com/repos/smartdevicelink/sdl_android/deployments","created_at":"2014-09-29T19:49:09Z","updated_at":"2017-08-15T23:52:57Z","pushed_at":"2017-09-20T20:50:33Z","git_url":"git://github.com/smartdevicelink/sdl_android.git","ssh_url":"git@github.com:smartdevicelink/sdl_android.git","clone_url":"https://github.com/smartdevicelink/sdl_android.git","svn_url":"https://github.com/smartdevicelink/sdl_android","homepage":"","size":9218,"stargazers_count":90,"watchers_count":90,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":72,"mirror_url":null,"open_issues_count":127,"forks":72,"open_issues":127,"watchers":90,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls/592"},"html":{"href":"https://github.com/smartdevicelink/sdl_android/pull/592"},"issue":{"href":"https://api.github.com/repos/smartdevicelink/sdl_android/issues/592"},"comments":{"href":"https://api.github.com/repos/smartdevicelink/sdl_android/issues/592/comments"},"review_comments":{"href":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls/592/comments"},"review_comment":{"href":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/smartdevicelink/sdl_android/pulls/592/commits"},"statuses":{"href":"https://api.github.com/repos/smartdevicelink/sdl_android/statuses/c13f727234e67fd5f6d377bdba53c70474cbb0e2"}},"author_association":"NONE"}}
{"actor":{"display_login":"brettywhite"}}