{"action":"created","comment":{"url":"https://api.github.com/repos/eocanha/webkit/pulls/comments/66208454","id":66208454,"diff_hunk":"@@ -242,6 +461,159 @@ static gboolean webKitMediaSrcQueryWithParent(GstPad* pad, GstObject* parent, Gs\n     return result;\n }\n \n+static void webKitMediaSrcCheckAllTracksConfigured(WebKitMediaSrc* webKitMediaSrc);\n+\n+static void webKitMediaSrcUpdatePresentationSize(GstCaps* caps, Stream* stream)\n+{\n+    GstStructure* s = gst_caps_get_structure(caps, 0);\n+    const gchar* structureName = gst_structure_get_name(s);\n+    GstVideoInfo info;\n+\n+    if (g_str_has_prefix(structureName, \"video/\") && gst_video_info_from_caps(&info, caps)) {\n+        float width, height;\n+\n+        // TODO: correct?\n+        width = info.width;\n+        height = info.height * ((float) info.par_d / (float) info.par_n);\n+\n+        GST_OBJECT_LOCK(stream->parent);\n+        stream->presentationSize = WebCore::FloatSize(width, height);\n+        GST_OBJECT_UNLOCK(stream->parent);\n+    } else {\n+        GST_OBJECT_LOCK(stream->parent);\n+        stream->presentationSize = WebCore::FloatSize();\n+        GST_OBJECT_UNLOCK(stream->parent);\n+    }\n+\n+    gst_caps_ref(caps);\n+    GST_OBJECT_LOCK(stream->parent);\n+    if (stream->caps)\n+        gst_caps_unref(stream->caps);\n+\n+    stream->caps = caps;\n+    GST_OBJECT_UNLOCK(stream->parent);\n+}\n+\n+static void webKitMediaSrcLinkStreamToSrcPad(GstPad* srcpad, Stream* stream)\n+{\n+    unsigned padId = static_cast<unsigned>(GPOINTER_TO_INT(g_object_get_data(G_OBJECT(srcpad), \"id\")));\n+    GST_DEBUG_OBJECT(stream->parent, \"linking stream to src pad (id: %u)\", padId);\n+\n+    GUniquePtr<gchar> padName(g_strdup_printf(\"src_%u\", padId));\n+    GstPad* ghostpad = WebCore::webkitGstGhostPadFromStaticTemplate(&srcTemplate, padName.get(), srcpad);\n+\n+    gst_pad_set_query_function(ghostpad, webKitMediaSrcQueryWithParent);\n+\n+    gst_pad_set_active(ghostpad, TRUE);\n+    gst_element_add_pad(GST_ELEMENT(stream->parent), ghostpad);\n+\n+    if (stream->decodebinSinkPad) {\n+        GST_DEBUG_OBJECT(stream->parent, \"A decodebin was previously used for this source, trying to reuse it.\");\n+        // TODO: error checking here. Not sure what to do if linking\n+        // fails though, because decodebin is out of this src\n+        // element's scope, in theory.\n+        gst_pad_link(ghostpad, stream->decodebinSinkPad);\n+    }\n+}\n+\n+static void webKitMediaSrcLinkParser(GstPad* srcpad, GstCaps* caps, Stream* stream)\n+{\n+    ASSERT(caps && stream->parent);\n+    if (!caps || !stream->parent) {\n+        GST_ERROR(\"Unable to link parser\");\n+        return;\n+    }\n+\n+    webKitMediaSrcUpdatePresentationSize(caps, stream);\n+\n+    // TODO: drop webKitMediaSrcLinkStreamToSrcPad() and move its code here...\n+    if (!gst_pad_is_linked(srcpad)) {\n+        GST_DEBUG_OBJECT(stream->parent, \"pad not linked yet\");\n+        webKitMediaSrcLinkStreamToSrcPad(srcpad, stream);\n+    }\n+\n+    webKitMediaSrcCheckAllTracksConfigured(stream->parent);\n+}\n+\n+static gboolean releaseStreamTrackInfo(WebKitMediaSrc* src, Stream* stream)\n+{\n+    GST_DEBUG(\"Freeing track-related info on stream %p\", stream);\n+\n+    WTF::GMutexLocker<GMutex> lock(src->priv->streamMutex);\n+\n+    if (stream->notifyReadyForMoreSamplesTag) {\n+        g_source_remove(stream->notifyReadyForMoreSamplesTag);\n+        stream->notifyReadyForMoreSamplesTag = 0;\n+    }\n+\n+    if (stream->caps) {\n+        gst_caps_unref(stream->caps);\n+        stream->caps = nullptr;\n+    }\n+#if ENABLE(VIDEO_TRACK)\n+    if (stream->audioTrack)\n+        stream->audioTrack = nullptr;\n+    if (stream->videoTrack)\n+        stream->videoTrack = nullptr;\n+#endif\n+\n+    int signal = -1;\n+    switch (stream->type) {\n+    case WebCore::Audio:\n+        signal = SIGNAL_AUDIO_CHANGED;\n+        break;\n+    case WebCore::Video:\n+        signal = SIGNAL_VIDEO_CHANGED;\n+        break;\n+    case WebCore::Text:\n+        signal = SIGNAL_TEXT_CHANGED;\n+        break;\n+    default:\n+        break;\n+    }\n+    stream->type = WebCore::Invalid;\n+\n+    if (signal != -1)\n+        g_signal_emit(G_OBJECT(src), webkit_media_src_signals[signal], 0, NULL);\n+\n+    g_cond_signal(&src->priv->streamCondition);\n+    return G_SOURCE_REMOVE;\n+}\n+\n+static gboolean freeStreamLater(Stream* stream)\n+{\n+    GST_DEBUG(\"Releasing stream: %p\", stream);\n+    g_free(stream);\n+\n+    return G_SOURCE_REMOVE;\n+}\n+","path":"Source/WebCore/platform/graphics/gstreamer/WebKitMediaSourceGStreamer.cpp","position":525,"original_position":525,"commit_id":"207d50a5caaad4886aeef16ee6c8bf4ef4e84916","original_commit_id":"4d3b91fcfb52f19e52732033c73273f4ce0c1252","user":{"login":"calvaris","id":1021526,"avatar_url":"https://avatars.githubusercontent.com/u/1021526?v=3","gravatar_id":"","url":"https://api.github.com/users/calvaris","html_url":"https://github.com/calvaris","followers_url":"https://api.github.com/users/calvaris/followers","following_url":"https://api.github.com/users/calvaris/following{/other_user}","gists_url":"https://api.github.com/users/calvaris/gists{/gist_id}","starred_url":"https://api.github.com/users/calvaris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calvaris/subscriptions","organizations_url":"https://api.github.com/users/calvaris/orgs","repos_url":"https://api.github.com/users/calvaris/repos","events_url":"https://api.github.com/users/calvaris/events{/privacy}","received_events_url":"https://api.github.com/users/calvaris/received_events","type":"User","site_admin":false},"body":"GSourceFunc is a typedef to a function signature. You only have to create a lambda with the same signature and you should be good to go. The only problem is that you can't capture variables.\r\n\r\nOn a second look, I don't see this freeStreamLater thing as something I like. This looks more like a workaround I would like to see justified.","created_at":"2016-06-08T08:00:59Z","updated_at":"2016-06-08T08:00:59Z","html_url":"https://github.com/eocanha/webkit/pull/1#discussion_r66208454","pull_request_url":"https://api.github.com/repos/eocanha/webkit/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/eocanha/webkit/pulls/comments/66208454"},"html":{"href":"https://github.com/eocanha/webkit/pull/1#discussion_r66208454"},"pull_request":{"href":"https://api.github.com/repos/eocanha/webkit/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/eocanha/webkit/pulls/1","id":68888898,"html_url":"https://github.com/eocanha/webkit/pull/1","diff_url":"https://github.com/eocanha/webkit/pull/1.diff","patch_url":"https://github.com/eocanha/webkit/pull/1.patch","issue_url":"https://api.github.com/repos/eocanha/webkit/issues/1","number":1,"state":"open","locked":false,"title":"Mse backport","user":{"login":"eocanha","id":6864279,"avatar_url":"https://avatars.githubusercontent.com/u/6864279?v=3","gravatar_id":"","url":"https://api.github.com/users/eocanha","html_url":"https://github.com/eocanha","followers_url":"https://api.github.com/users/eocanha/followers","following_url":"https://api.github.com/users/eocanha/following{/other_user}","gists_url":"https://api.github.com/users/eocanha/gists{/gist_id}","starred_url":"https://api.github.com/users/eocanha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eocanha/subscriptions","organizations_url":"https://api.github.com/users/eocanha/orgs","repos_url":"https://api.github.com/users/eocanha/repos","events_url":"https://api.github.com/users/eocanha/events{/privacy}","received_events_url":"https://api.github.com/users/eocanha/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-04T16:09:56Z","updated_at":"2016-06-08T08:00:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c0ecca5dd75d3a1a2a3a6087626b8476ac5b6c9a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/eocanha/webkit/pulls/1/commits","review_comments_url":"https://api.github.com/repos/eocanha/webkit/pulls/1/comments","review_comment_url":"https://api.github.com/repos/eocanha/webkit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eocanha/webkit/issues/1/comments","statuses_url":"https://api.github.com/repos/eocanha/webkit/statuses/207d50a5caaad4886aeef16ee6c8bf4ef4e84916","head":{"label":"eocanha:mse-backport-rebased-20160425-sq","ref":"mse-backport-rebased-20160425-sq","sha":"207d50a5caaad4886aeef16ee6c8bf4ef4e84916","user":{"login":"eocanha","id":6864279,"avatar_url":"https://avatars.githubusercontent.com/u/6864279?v=3","gravatar_id":"","url":"https://api.github.com/users/eocanha","html_url":"https://github.com/eocanha","followers_url":"https://api.github.com/users/eocanha/followers","following_url":"https://api.github.com/users/eocanha/following{/other_user}","gists_url":"https://api.github.com/users/eocanha/gists{/gist_id}","starred_url":"https://api.github.com/users/eocanha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eocanha/subscriptions","organizations_url":"https://api.github.com/users/eocanha/orgs","repos_url":"https://api.github.com/users/eocanha/repos","events_url":"https://api.github.com/users/eocanha/events{/privacy}","received_events_url":"https://api.github.com/users/eocanha/received_events","type":"User","site_admin":false},"repo":{"id":49714349,"name":"webkit","full_name":"eocanha/webkit","owner":{"login":"eocanha","id":6864279,"avatar_url":"https://avatars.githubusercontent.com/u/6864279?v=3","gravatar_id":"","url":"https://api.github.com/users/eocanha","html_url":"https://github.com/eocanha","followers_url":"https://api.github.com/users/eocanha/followers","following_url":"https://api.github.com/users/eocanha/following{/other_user}","gists_url":"https://api.github.com/users/eocanha/gists{/gist_id}","starred_url":"https://api.github.com/users/eocanha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eocanha/subscriptions","organizations_url":"https://api.github.com/users/eocanha/orgs","repos_url":"https://api.github.com/users/eocanha/repos","events_url":"https://api.github.com/users/eocanha/events{/privacy}","received_events_url":"https://api.github.com/users/eocanha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eocanha/webkit","description":"Unofficial mirror of the WebKit SVN repository","fork":true,"url":"https://api.github.com/repos/eocanha/webkit","forks_url":"https://api.github.com/repos/eocanha/webkit/forks","keys_url":"https://api.github.com/repos/eocanha/webkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eocanha/webkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eocanha/webkit/teams","hooks_url":"https://api.github.com/repos/eocanha/webkit/hooks","issue_events_url":"https://api.github.com/repos/eocanha/webkit/issues/events{/number}","events_url":"https://api.github.com/repos/eocanha/webkit/events","assignees_url":"https://api.github.com/repos/eocanha/webkit/assignees{/user}","branches_url":"https://api.github.com/repos/eocanha/webkit/branches{/branch}","tags_url":"https://api.github.com/repos/eocanha/webkit/tags","blobs_url":"https://api.github.com/repos/eocanha/webkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eocanha/webkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eocanha/webkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/eocanha/webkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eocanha/webkit/statuses/{sha}","languages_url":"https://api.github.com/repos/eocanha/webkit/languages","stargazers_url":"https://api.github.com/repos/eocanha/webkit/stargazers","contributors_url":"https://api.github.com/repos/eocanha/webkit/contributors","subscribers_url":"https://api.github.com/repos/eocanha/webkit/subscribers","subscription_url":"https://api.github.com/repos/eocanha/webkit/subscription","commits_url":"https://api.github.com/repos/eocanha/webkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/eocanha/webkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/eocanha/webkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/eocanha/webkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/eocanha/webkit/contents/{+path}","compare_url":"https://api.github.com/repos/eocanha/webkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eocanha/webkit/merges","archive_url":"https://api.github.com/repos/eocanha/webkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eocanha/webkit/downloads","issues_url":"https://api.github.com/repos/eocanha/webkit/issues{/number}","pulls_url":"https://api.github.com/repos/eocanha/webkit/pulls{/number}","milestones_url":"https://api.github.com/repos/eocanha/webkit/milestones{/number}","notifications_url":"https://api.github.com/repos/eocanha/webkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eocanha/webkit/labels{/name}","releases_url":"https://api.github.com/repos/eocanha/webkit/releases{/id}","deployments_url":"https://api.github.com/repos/eocanha/webkit/deployments","created_at":"2016-01-15T11:07:43Z","updated_at":"2016-01-15T09:28:48Z","pushed_at":"2016-05-06T11:12:52Z","git_url":"git://github.com/eocanha/webkit.git","ssh_url":"git@github.com:eocanha/webkit.git","clone_url":"https://github.com/eocanha/webkit.git","svn_url":"https://github.com/eocanha/webkit","homepage":"http://www.webkit.org/","size":7249736,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"eocanha:master","ref":"master","sha":"c3035c080aebda88b4e8078c87f43318dd2db953","user":{"login":"eocanha","id":6864279,"avatar_url":"https://avatars.githubusercontent.com/u/6864279?v=3","gravatar_id":"","url":"https://api.github.com/users/eocanha","html_url":"https://github.com/eocanha","followers_url":"https://api.github.com/users/eocanha/followers","following_url":"https://api.github.com/users/eocanha/following{/other_user}","gists_url":"https://api.github.com/users/eocanha/gists{/gist_id}","starred_url":"https://api.github.com/users/eocanha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eocanha/subscriptions","organizations_url":"https://api.github.com/users/eocanha/orgs","repos_url":"https://api.github.com/users/eocanha/repos","events_url":"https://api.github.com/users/eocanha/events{/privacy}","received_events_url":"https://api.github.com/users/eocanha/received_events","type":"User","site_admin":false},"repo":{"id":49714349,"name":"webkit","full_name":"eocanha/webkit","owner":{"login":"eocanha","id":6864279,"avatar_url":"https://avatars.githubusercontent.com/u/6864279?v=3","gravatar_id":"","url":"https://api.github.com/users/eocanha","html_url":"https://github.com/eocanha","followers_url":"https://api.github.com/users/eocanha/followers","following_url":"https://api.github.com/users/eocanha/following{/other_user}","gists_url":"https://api.github.com/users/eocanha/gists{/gist_id}","starred_url":"https://api.github.com/users/eocanha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eocanha/subscriptions","organizations_url":"https://api.github.com/users/eocanha/orgs","repos_url":"https://api.github.com/users/eocanha/repos","events_url":"https://api.github.com/users/eocanha/events{/privacy}","received_events_url":"https://api.github.com/users/eocanha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eocanha/webkit","description":"Unofficial mirror of the WebKit SVN repository","fork":true,"url":"https://api.github.com/repos/eocanha/webkit","forks_url":"https://api.github.com/repos/eocanha/webkit/forks","keys_url":"https://api.github.com/repos/eocanha/webkit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eocanha/webkit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eocanha/webkit/teams","hooks_url":"https://api.github.com/repos/eocanha/webkit/hooks","issue_events_url":"https://api.github.com/repos/eocanha/webkit/issues/events{/number}","events_url":"https://api.github.com/repos/eocanha/webkit/events","assignees_url":"https://api.github.com/repos/eocanha/webkit/assignees{/user}","branches_url":"https://api.github.com/repos/eocanha/webkit/branches{/branch}","tags_url":"https://api.github.com/repos/eocanha/webkit/tags","blobs_url":"https://api.github.com/repos/eocanha/webkit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eocanha/webkit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eocanha/webkit/git/refs{/sha}","trees_url":"https://api.github.com/repos/eocanha/webkit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eocanha/webkit/statuses/{sha}","languages_url":"https://api.github.com/repos/eocanha/webkit/languages","stargazers_url":"https://api.github.com/repos/eocanha/webkit/stargazers","contributors_url":"https://api.github.com/repos/eocanha/webkit/contributors","subscribers_url":"https://api.github.com/repos/eocanha/webkit/subscribers","subscription_url":"https://api.github.com/repos/eocanha/webkit/subscription","commits_url":"https://api.github.com/repos/eocanha/webkit/commits{/sha}","git_commits_url":"https://api.github.com/repos/eocanha/webkit/git/commits{/sha}","comments_url":"https://api.github.com/repos/eocanha/webkit/comments{/number}","issue_comment_url":"https://api.github.com/repos/eocanha/webkit/issues/comments{/number}","contents_url":"https://api.github.com/repos/eocanha/webkit/contents/{+path}","compare_url":"https://api.github.com/repos/eocanha/webkit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eocanha/webkit/merges","archive_url":"https://api.github.com/repos/eocanha/webkit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eocanha/webkit/downloads","issues_url":"https://api.github.com/repos/eocanha/webkit/issues{/number}","pulls_url":"https://api.github.com/repos/eocanha/webkit/pulls{/number}","milestones_url":"https://api.github.com/repos/eocanha/webkit/milestones{/number}","notifications_url":"https://api.github.com/repos/eocanha/webkit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eocanha/webkit/labels{/name}","releases_url":"https://api.github.com/repos/eocanha/webkit/releases{/id}","deployments_url":"https://api.github.com/repos/eocanha/webkit/deployments","created_at":"2016-01-15T11:07:43Z","updated_at":"2016-01-15T09:28:48Z","pushed_at":"2016-05-06T11:12:52Z","git_url":"git://github.com/eocanha/webkit.git","ssh_url":"git@github.com:eocanha/webkit.git","clone_url":"https://github.com/eocanha/webkit.git","svn_url":"https://github.com/eocanha/webkit","homepage":"http://www.webkit.org/","size":7249736,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eocanha/webkit/pulls/1"},"html":{"href":"https://github.com/eocanha/webkit/pull/1"},"issue":{"href":"https://api.github.com/repos/eocanha/webkit/issues/1"},"comments":{"href":"https://api.github.com/repos/eocanha/webkit/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/eocanha/webkit/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/eocanha/webkit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eocanha/webkit/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/eocanha/webkit/statuses/207d50a5caaad4886aeef16ee6c8bf4ef4e84916"}}}}
{"actor":{"display_login":"calvaris"}}