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

Unified Diff: third_party/WebKit/Source/modules/mediasource/AudioTrackSourceBuffer.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/AudioTrackSourceBuffer.cpp
diff --git a/third_party/WebKit/Source/modules/mediasource/AudioTrackSourceBuffer.cpp b/third_party/WebKit/Source/modules/mediasource/AudioTrackSourceBuffer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5c17acc37005fd61479a8ab04c9f1441cfa4f608
--- /dev/null
+++ b/third_party/WebKit/Source/modules/mediasource/AudioTrackSourceBuffer.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/AudioTrackSourceBuffer.h"
+
+#include "core/html/track/AudioTrack.h"
+#include "modules/mediasource/SourceBuffer.h"
+
+namespace blink {
+
+AudioTrackSourceBuffer::AudioTrackSourceBuffer(SourceBuffer* sourceBuffer)
+ : m_sourceBuffer(sourceBuffer)
+{
+}
+
+AudioTrackSourceBuffer::~AudioTrackSourceBuffer()
+{
+}
+
+const char* AudioTrackSourceBuffer::supplementName()
+{
+ return "AudioTrackSourceBuffer";
+}
+
+AudioTrackSourceBuffer& AudioTrackSourceBuffer::from(AudioTrack& track)
+{
+ AudioTrackSourceBuffer* supplement = static_cast<AudioTrackSourceBuffer*>(HeapSupplement<AudioTrack>::from(track, supplementName()));
+ if (!supplement) {
+ supplement = new AudioTrackSourceBuffer(nullptr);
+ provideTo(track, supplementName(), supplement);
+ }
+ return *supplement;
+}
+
+// static
+SourceBuffer* AudioTrackSourceBuffer::sourceBuffer(AudioTrack& track)
+{
+ return AudioTrackSourceBuffer::from(track).m_sourceBuffer;
+}
+
+
+DEFINE_TRACE(AudioTrackSourceBuffer)
+{
+ visitor->trace(m_sourceBuffer);
+ HeapSupplement<AudioTrack>::trace(visitor);
+}
+
+} // namespace blink
+

Powered by Google App Engine
This is Rietveld 408576698