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 |
+ |