Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(619)

Unified Diff: third_party/WebKit/Source/modules/mediasource/VideoTrackSourceBuffer.cpp

Issue 1658033002: Add SourceBuffer implementations of Audio/VideoTracks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-media-tracks-to-blink
Patch Set: Make Audio/VideoTrackSB finalizable again Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/mediasource/VideoTrackSourceBuffer.cpp
diff --git a/third_party/WebKit/Source/modules/mediasource/VideoTrackSourceBuffer.cpp b/third_party/WebKit/Source/modules/mediasource/VideoTrackSourceBuffer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..cc9492fffd4f1adddc61eb0ebfaf1b25c6e255df
--- /dev/null
+++ b/third_party/WebKit/Source/modules/mediasource/VideoTrackSourceBuffer.cpp
@@ -0,0 +1,50 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "modules/mediasource/VideoTrackSourceBuffer.h"
+
+#include "core/html/track/VideoTrack.h"
+#include "modules/mediasource/SourceBuffer.h"
+
+namespace blink {
+
+VideoTrackSourceBuffer::VideoTrackSourceBuffer(SourceBuffer* sourceBuffer)
+ : m_sourceBuffer(sourceBuffer)
+{
+}
+
+VideoTrackSourceBuffer::~VideoTrackSourceBuffer()
+{
+}
+
+const char* VideoTrackSourceBuffer::supplementName()
+{
+ return "VideoTrackSourceBuffer";
+}
+
+VideoTrackSourceBuffer& VideoTrackSourceBuffer::from(VideoTrack& track)
+{
+ VideoTrackSourceBuffer* supplement = static_cast<VideoTrackSourceBuffer*>(HeapSupplement<VideoTrack>::from(track, supplementName()));
+ if (!supplement) {
+ supplement = new VideoTrackSourceBuffer(nullptr);
+ provideTo(track, supplementName(), supplement);
+ }
+ return *supplement;
+}
+
+// static
+SourceBuffer* VideoTrackSourceBuffer::sourceBuffer(VideoTrack& track)
+{
+ return VideoTrackSourceBuffer::from(track).m_sourceBuffer;
+}
+
+
+DEFINE_TRACE(VideoTrackSourceBuffer)
+{
+ visitor->trace(m_sourceBuffer);
+ HeapSupplement<VideoTrack>::trace(visitor);
+}
+
+} // namespace blink
+

Powered by Google App Engine
This is Rietveld 408576698