| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 "while the SourceBuffer's append " | 262 "while the SourceBuffer's append " |
| 263 "state is 'PARSING_MEDIA_SEGMENT'."); | 263 "state is 'PARSING_MEDIA_SEGMENT'."); |
| 264 return; | 264 return; |
| 265 } | 265 } |
| 266 | 266 |
| 267 // 7. Update the attribute to new timestamp offset. | 267 // 7. Update the attribute to new timestamp offset. |
| 268 m_timestampOffset = offset; | 268 m_timestampOffset = offset; |
| 269 } | 269 } |
| 270 | 270 |
| 271 AudioTrackList& SourceBuffer::audioTracks() { | 271 AudioTrackList& SourceBuffer::audioTracks() { |
| 272 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 272 DCHECK(HTMLMediaElement::mediaTracksEnabledInternally()); |
| 273 return *m_audioTracks; | 273 return *m_audioTracks; |
| 274 } | 274 } |
| 275 | 275 |
| 276 VideoTrackList& SourceBuffer::videoTracks() { | 276 VideoTrackList& SourceBuffer::videoTracks() { |
| 277 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 277 DCHECK(HTMLMediaElement::mediaTracksEnabledInternally()); |
| 278 return *m_videoTracks; | 278 return *m_videoTracks; |
| 279 } | 279 } |
| 280 | 280 |
| 281 double SourceBuffer::appendWindowStart() const { | 281 double SourceBuffer::appendWindowStart() const { |
| 282 return m_appendWindowStart; | 282 return m_appendWindowStart; |
| 283 } | 283 } |
| 284 | 284 |
| 285 void SourceBuffer::setAppendWindowStart(double start, | 285 void SourceBuffer::setAppendWindowStart(double start, |
| 286 ExceptionState& exceptionState) { | 286 ExceptionState& exceptionState) { |
| 287 BLINK_SBLOG << __func__ << " this=" << this << " start=" << start; | 287 BLINK_SBLOG << __func__ << " this=" << this << " start=" << start; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 if (isRemoved()) | 562 if (isRemoved()) |
| 563 return; | 563 return; |
| 564 | 564 |
| 565 BLINK_SBLOG << __func__ << " this=" << this; | 565 BLINK_SBLOG << __func__ << " this=" << this; |
| 566 if (m_pendingRemoveStart != -1) { | 566 if (m_pendingRemoveStart != -1) { |
| 567 cancelRemove(); | 567 cancelRemove(); |
| 568 } else { | 568 } else { |
| 569 abortIfUpdating(); | 569 abortIfUpdating(); |
| 570 } | 570 } |
| 571 | 571 |
| 572 if (RuntimeEnabledFeatures::audioVideoTracksEnabled()) { | 572 if (HTMLMediaElement::mediaTracksEnabledInternally()) { |
| 573 DCHECK(m_source); | 573 DCHECK(m_source); |
| 574 if (m_source->mediaElement()->audioTracks().length() > 0 || | 574 if (m_source->mediaElement()->audioTracks().length() > 0 || |
| 575 m_source->mediaElement()->videoTracks().length() > 0) { | 575 m_source->mediaElement()->videoTracks().length() > 0) { |
| 576 removeMediaTracks(); | 576 removeMediaTracks(); |
| 577 } | 577 } |
| 578 } | 578 } |
| 579 | 579 |
| 580 m_webSourceBuffer->removedFromMediaSource(); | 580 m_webSourceBuffer->removedFromMediaSource(); |
| 581 m_webSourceBuffer.reset(); | 581 m_webSourceBuffer.reset(); |
| 582 m_source = nullptr; | 582 m_source = nullptr; |
| 583 m_asyncEventQueue = nullptr; | 583 m_asyncEventQueue = nullptr; |
| 584 } | 584 } |
| 585 | 585 |
| 586 double SourceBuffer::highestPresentationTimestamp() { | 586 double SourceBuffer::highestPresentationTimestamp() { |
| 587 DCHECK(!isRemoved()); | 587 DCHECK(!isRemoved()); |
| 588 | 588 |
| 589 double pts = m_webSourceBuffer->highestPresentationTimestamp(); | 589 double pts = m_webSourceBuffer->highestPresentationTimestamp(); |
| 590 BLINK_SBLOG << __func__ << " this=" << this << ", pts=" << pts; | 590 BLINK_SBLOG << __func__ << " this=" << this << ", pts=" << pts; |
| 591 return pts; | 591 return pts; |
| 592 } | 592 } |
| 593 | 593 |
| 594 void SourceBuffer::removeMediaTracks() { | 594 void SourceBuffer::removeMediaTracks() { |
| 595 DCHECK(RuntimeEnabledFeatures::audioVideoTracksEnabled()); | 595 DCHECK(HTMLMediaElement::mediaTracksEnabledInternally()); |
| 596 // Spec: | 596 // Spec: |
| 597 // http://w3c.github.io/media-source/#widl-MediaSource-removeSourceBuffer-void
-SourceBuffer-sourceBuffer | 597 // http://w3c.github.io/media-source/#widl-MediaSource-removeSourceBuffer-void
-SourceBuffer-sourceBuffer |
| 598 DCHECK(m_source); | 598 DCHECK(m_source); |
| 599 | 599 |
| 600 HTMLMediaElement* mediaElement = m_source->mediaElement(); | 600 HTMLMediaElement* mediaElement = m_source->mediaElement(); |
| 601 DCHECK(mediaElement); | 601 DCHECK(mediaElement); |
| 602 // 3. Let SourceBuffer audioTracks list equal the AudioTrackList object | 602 // 3. Let SourceBuffer audioTracks list equal the AudioTrackList object |
| 603 // returned by sourceBuffer.audioTracks. | 603 // returned by sourceBuffer.audioTracks. |
| 604 // 4. If the SourceBuffer audioTracks list is not empty, then run the | 604 // 4. If the SourceBuffer audioTracks list is not empty, then run the |
| 605 // following steps: | 605 // following steps: |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 return trackDefault ? AtomicString(trackDefault->language()) : ""; | 749 return trackDefault ? AtomicString(trackDefault->language()) : ""; |
| 750 } | 750 } |
| 751 | 751 |
| 752 bool SourceBuffer::initializationSegmentReceived( | 752 bool SourceBuffer::initializationSegmentReceived( |
| 753 const WebVector<MediaTrackInfo>& newTracks) { | 753 const WebVector<MediaTrackInfo>& newTracks) { |
| 754 BLINK_SBLOG << __func__ << " this=" << this << " tracks=" << newTracks.size(); | 754 BLINK_SBLOG << __func__ << " this=" << this << " tracks=" << newTracks.size(); |
| 755 DCHECK(m_source); | 755 DCHECK(m_source); |
| 756 DCHECK(m_source->mediaElement()); | 756 DCHECK(m_source->mediaElement()); |
| 757 DCHECK(m_updating); | 757 DCHECK(m_updating); |
| 758 | 758 |
| 759 if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) { | 759 if (!HTMLMediaElement::mediaTracksEnabledInternally()) { |
| 760 if (!m_firstInitializationSegmentReceived) { | 760 if (!m_firstInitializationSegmentReceived) { |
| 761 m_source->setSourceBufferActive(this, true); | 761 m_source->setSourceBufferActive(this, true); |
| 762 m_firstInitializationSegmentReceived = true; | 762 m_firstInitializationSegmentReceived = true; |
| 763 } | 763 } |
| 764 return true; | 764 return true; |
| 765 } | 765 } |
| 766 | 766 |
| 767 // Implementation of Initialization Segment Received, see | 767 // Implementation of Initialization Segment Received, see |
| 768 // https://w3c.github.io/media-source/#sourcebuffer-init-segment-received | 768 // https://w3c.github.io/media-source/#sourcebuffer-init-segment-received |
| 769 | 769 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 visitor->trace(m_asyncEventQueue); | 1306 visitor->trace(m_asyncEventQueue); |
| 1307 visitor->trace(m_appendBufferAsyncPartRunner); | 1307 visitor->trace(m_appendBufferAsyncPartRunner); |
| 1308 visitor->trace(m_removeAsyncPartRunner); | 1308 visitor->trace(m_removeAsyncPartRunner); |
| 1309 visitor->trace(m_audioTracks); | 1309 visitor->trace(m_audioTracks); |
| 1310 visitor->trace(m_videoTracks); | 1310 visitor->trace(m_videoTracks); |
| 1311 EventTargetWithInlineData::trace(visitor); | 1311 EventTargetWithInlineData::trace(visitor); |
| 1312 ActiveDOMObject::trace(visitor); | 1312 ActiveDOMObject::trace(visitor); |
| 1313 } | 1313 } |
| 1314 | 1314 |
| 1315 } // namespace blink | 1315 } // namespace blink |
| OLD | NEW |