OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "modules/mediasource/AudioTrackSourceBuffer.h" |
| 6 |
| 7 #include "core/html/track/AudioTrack.h" |
| 8 #include "modules/mediasource/SourceBuffer.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 AudioTrackSourceBuffer::AudioTrackSourceBuffer(SourceBuffer* sourceBuffer) |
| 13 : m_sourceBuffer(sourceBuffer) |
| 14 { |
| 15 } |
| 16 |
| 17 AudioTrackSourceBuffer::~AudioTrackSourceBuffer() |
| 18 { |
| 19 } |
| 20 |
| 21 const char* AudioTrackSourceBuffer::supplementName() |
| 22 { |
| 23 return "AudioTrackSourceBuffer"; |
| 24 } |
| 25 |
| 26 AudioTrackSourceBuffer& AudioTrackSourceBuffer::from(AudioTrack& track) |
| 27 { |
| 28 AudioTrackSourceBuffer* supplement = static_cast<AudioTrackSourceBuffer*>(He
apSupplement<AudioTrack>::from(track, supplementName())); |
| 29 if (!supplement) { |
| 30 supplement = new AudioTrackSourceBuffer(nullptr); |
| 31 provideTo(track, supplementName(), supplement); |
| 32 } |
| 33 return *supplement; |
| 34 } |
| 35 |
| 36 // static |
| 37 SourceBuffer* AudioTrackSourceBuffer::sourceBuffer(AudioTrack& track) |
| 38 { |
| 39 return AudioTrackSourceBuffer::from(track).m_sourceBuffer; |
| 40 } |
| 41 |
| 42 |
| 43 DEFINE_TRACE(AudioTrackSourceBuffer) |
| 44 { |
| 45 visitor->trace(m_sourceBuffer); |
| 46 HeapSupplement<AudioTrack>::trace(visitor); |
| 47 } |
| 48 |
| 49 } // namespace blink |
| 50 |
OLD | NEW |