{"action":"created","comment":{"url":"https://api.github.com/repos/eocanha/webkit/pulls/comments/62207874","id":62207874,"diff_hunk":"@@ -24,35 +25,141 @@\n \n #if ENABLE(VIDEO) && ENABLE(MEDIA_SOURCE) && USE(GSTREAMER)\n \n+#include \"AudioTrackPrivateGStreamer.h\"\n #include \"GStreamerUtilities.h\"\n+#include \"MediaDescription.h\"\n+#include \"MediaPlayerPrivateGStreamerMSE.h\"\n+#include \"MediaSample.h\"\n+#include \"MediaSourceGStreamer.h\"\n #include \"NotImplemented.h\"\n+#include \"SourceBufferPrivateGStreamer.h\"\n #include \"TimeRanges.h\"\n+#include \"VideoTrackPrivateGStreamer.h\"\n \n+#include <gst/app/app.h>\n #include <gst/app/gstappsrc.h>\n #include <gst/gst.h>\n #include <gst/pbutils/missing-plugins.h>\n-#include <wtf/glib/GUniquePtr.h>\n+#include <gst/pbutils/pbutils.h>\n+#include <gst/video/video.h>\n #include <wtf/text/CString.h>\n+#include <wtf/glib/GMutexLocker.h>\n+#include <wtf/glib/GUniquePtr.h>\n+#include <wtf/MainThread.h>\n+\n+// To make LOG_MEDIA_MESSAGE() work outside the WebCore namespace.\n+#if !LOG_DISABLED\n+using WebCore::LogMedia;\n+#endif\n \n-typedef struct _Source Source;\n-struct _Source {\n-    GstElement* src;\n-    // Just for identification\n-    WebCore::SourceBufferPrivate* sourceBuffer;\n+typedef struct _Stream Stream;\n+\n+struct _Stream\n+{\n+    // Fields filled when the Stream is created.\n+    WebKitMediaSrc* parent;\n+\n+    // AppSrc\n+    GstElement* appsrc;\n+    GstPad* decodebinSinkPad;\n+    WebCore::SourceBufferPrivateGStreamer* sourceBuffer;\n+\n+    // Fields filled when the track is attached.\n+    WebCore::MediaSourceStreamTypeGStreamer type;\n+    // Might be 0, e.g. for VP8/VP9\n+    GstElement *parser;\n+    GstCaps* caps;\n+#if ENABLE(VIDEO_TRACK)\n+    RefPtr<WebCore::AudioTrackPrivateGStreamer> audioTrack;\n+    RefPtr<WebCore::VideoTrackPrivateGStreamer> videoTrack;\n+#endif\n+    WebCore::FloatSize presentationSize;\n+\n+    // This helps WebKitMediaSrcPrivate.appSrcNeedDataCount, ensuring that needDatas are\n+    // counted only once per each appsrc.\n+    bool appSrcNeedDataFlag;\n+\n+    // Used to enforce continuity in the appended data and avoid breaking the decoder.\n+    MediaTime lastEnqueuedTime;\n+\n+    guint notifyReadyForMoreSamplesTag;\n };\n \n-struct _WebKitMediaSrcPrivate {\n-    GList* sources;\n+enum OnSeekDataAction {\n+    Nothing,\n+    MediaSourceSeekToTime\n+};\n+\n+struct ReleaseStreamTrackInfoTimer {\n+    ReleaseStreamTrackInfoTimer()\n+        : timer(RunLoop::main(), this, &ReleaseStreamTrackInfoTimer::fired)\n+    { }\n+\n+    void fired() { std::exchange(callback, nullptr)(); }\n+\n+    std::function<void ()> callback;\n+    RunLoop::Timer<ReleaseStreamTrackInfoTimer> timer;\n+};\n+\n+struct _WebKitMediaSrcPrivate\n+{\n+    _WebKitMediaSrcPrivate()\n+    {\n+        g_mutex_init(&streamMutex);\n+        g_cond_init(&streamCondition);\n+    }\n+\n+    ~_WebKitMediaSrcPrivate()\n+    {\n+        g_mutex_clear(&streamMutex);\n+        g_cond_clear(&streamCondition);\n+    }\n+\n+    void timeoutSourceFired()\n+    {\n+\n+    }\n+\n+    // Used to coordinate the release of Stream track info.\n+    GMutex streamMutex;\n+    GCond streamCondition;\n+    ReleaseStreamTrackInfoTimer timeoutSource;\n+\n+    GList* streams;","path":"Source/WebCore/platform/graphics/gstreamer/WebKitMediaSourceGStreamer.cpp","position":122,"original_position":122,"commit_id":"4d3b91fcfb52f19e52732033c73273f4ce0c1252","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":"Turn this into a Deque, The operations we use would be 0(1)","created_at":"2016-05-05T15:55:22Z","updated_at":"2016-05-05T15:55:22Z","html_url":"https://github.com/eocanha/webkit/pull/1#discussion_r62207874","pull_request_url":"https://api.github.com/repos/eocanha/webkit/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/eocanha/webkit/pulls/comments/62207874"},"html":{"href":"https://github.com/eocanha/webkit/pull/1#discussion_r62207874"},"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-05-05T15:55:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ec8b027f58be6378cc3dbd649cc75fa687318bdd","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/4d3b91fcfb52f19e52732033c73273f4ce0c1252","head":{"label":"eocanha:mse-backport-rebased-20160425-sq","ref":"mse-backport-rebased-20160425-sq","sha":"4d3b91fcfb52f19e52732033c73273f4ce0c1252","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-04T16:09:58Z","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":7247872,"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-04T16:09:58Z","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":7247872,"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/4d3b91fcfb52f19e52732033c73273f4ce0c1252"}}}}