Chromium Code Reviews| 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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 // 1. If this object has been removed from the sourceBuffers attribute of t he parent media source then throw an InvalidStateError exception and abort these steps. | 506 // 1. If this object has been removed from the sourceBuffers attribute of t he parent media source then throw an InvalidStateError exception and abort these steps. |
| 507 // 2. If the updating attribute equals true, then throw an InvalidStateErro r exception and abort these steps. | 507 // 2. If the updating attribute equals true, then throw an InvalidStateErro r exception and abort these steps. |
| 508 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat e)) | 508 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat e)) |
| 509 return; | 509 return; |
| 510 | 510 |
| 511 TRACE_EVENT_ASYNC_BEGIN1("media", "SourceBuffer::appendBuffer", this, "size" , size); | 511 TRACE_EVENT_ASYNC_BEGIN1("media", "SourceBuffer::appendBuffer", this, "size" , size); |
| 512 | 512 |
| 513 // 3. If the readyState attribute of the parent media source is in the "end ed" state then run the following steps: ... | 513 // 3. If the readyState attribute of the parent media source is in the "end ed" state then run the following steps: ... |
| 514 m_source->openIfInEndedState(); | 514 m_source->openIfInEndedState(); |
| 515 | 515 |
| 516 // Steps 4-5 - end "prepare append" algorithm. | 516 // 4. Run the coded frame eviction algorithm. |
| 517 if (!evictCodedFrames()) { | |
| 518 // 5. If the buffer full flag equals true, then throw a QUOTA_EXCEEDED_ ERR exception and abort these steps. | |
|
philipj_slow
2014/12/10 09:28:26
I see that we don't have an explicit "buffer full
kjoswiak
2014/12/10 19:11:45
Though other thing I considered doing is adding a
| |
| 519 exceptionState.throwDOMException(QuotaExceededError, "The SourceBuffer i s full, and cannot free space append additional buffers."); | |
|
philipj_slow
2014/12/10 09:28:26
missing "to"
kjoswiak
2014/12/10 19:11:45
Done.
| |
| 520 return; | |
| 521 } | |
| 517 | 522 |
| 518 // 2. Add data to the end of the input buffer. | 523 // 2. Add data to the end of the input buffer. |
| 519 ASSERT(data || size == 0); | 524 ASSERT(data || size == 0); |
| 520 if (data) | 525 if (data) |
| 521 m_pendingAppendData.append(data, size); | 526 m_pendingAppendData.append(data, size); |
| 522 m_pendingAppendDataOffset = 0; | 527 m_pendingAppendDataOffset = 0; |
| 523 | 528 |
| 524 // 3. Set the updating attribute to true. | 529 // 3. Set the updating attribute to true. |
| 525 m_updating = true; | 530 m_updating = true; |
| 526 | 531 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 m_pendingRemoveStart = -1; | 609 m_pendingRemoveStart = -1; |
| 605 m_pendingRemoveEnd = -1; | 610 m_pendingRemoveEnd = -1; |
| 606 | 611 |
| 607 // 11. Queue a task to fire a simple event named update at this SourceBuffer object. | 612 // 11. Queue a task to fire a simple event named update at this SourceBuffer object. |
| 608 scheduleEvent(EventTypeNames::update); | 613 scheduleEvent(EventTypeNames::update); |
| 609 | 614 |
| 610 // 12. Queue a task to fire a simple event named updateend at this SourceBuf fer object. | 615 // 12. Queue a task to fire a simple event named updateend at this SourceBuf fer object. |
| 611 scheduleEvent(EventTypeNames::updateend); | 616 scheduleEvent(EventTypeNames::updateend); |
| 612 } | 617 } |
| 613 | 618 |
| 619 bool SourceBuffer::evictCodedFrames() | |
| 620 { | |
| 621 return m_webSourceBuffer->evictCodedFrames(); | |
| 622 } | |
| 623 | |
| 614 void SourceBuffer::appendStreamInternal(PassRefPtrWillBeRawPtr<Stream> stream, E xceptionState& exceptionState) | 624 void SourceBuffer::appendStreamInternal(PassRefPtrWillBeRawPtr<Stream> stream, E xceptionState& exceptionState) |
| 615 { | 625 { |
| 616 // Section 3.2 appendStream() | 626 // Section 3.2 appendStream() |
| 617 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou rce.html#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-ma xSize | 627 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou rce.html#widl-SourceBuffer-appendStream-void-Stream-stream-unsigned-long-long-ma xSize |
| 618 // (0. If the stream has been neutered, then throw an InvalidAccessError exc eption and abort these steps.) | 628 // (0. If the stream has been neutered, then throw an InvalidAccessError exc eption and abort these steps.) |
| 619 if (stream->isNeutered()) { | 629 if (stream->isNeutered()) { |
| 620 exceptionState.throwDOMException(InvalidAccessError, "The stream provide d has been neutered."); | 630 exceptionState.throwDOMException(InvalidAccessError, "The stream provide d has been neutered."); |
| 621 return; | 631 return; |
| 622 } | 632 } |
| 623 | 633 |
| 624 // 1. Run the prepare append algorithm. | 634 // 1. Run the prepare append algorithm. |
| 625 // Section 3.5.4 Prepare Append Algorithm. | 635 // Section 3.5.4 Prepare Append Algorithm. |
| 626 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-so urce.html#sourcebuffer-prepare-append | 636 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-so urce.html#sourcebuffer-prepare-append |
| 627 // 1. If this object has been removed from the sourceBuffers attribute of t he parent media source then throw an InvalidStateError exception and abort these steps. | 637 // 1. If this object has been removed from the sourceBuffers attribute of t he parent media source then throw an InvalidStateError exception and abort these steps. |
| 628 // 2. If the updating attribute equals true, then throw an InvalidStateErro r exception and abort these steps. | 638 // 2. If the updating attribute equals true, then throw an InvalidStateErro r exception and abort these steps. |
| 629 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat e)) | 639 if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionStat e)) |
| 630 return; | 640 return; |
| 631 | 641 |
| 632 TRACE_EVENT_ASYNC_BEGIN0("media", "SourceBuffer::appendStream", this); | 642 TRACE_EVENT_ASYNC_BEGIN0("media", "SourceBuffer::appendStream", this); |
| 633 | 643 |
| 634 // 3. If the readyState attribute of the parent media source is in the "end ed" state then run the following steps: ... | 644 // 3. If the readyState attribute of the parent media source is in the "end ed" state then run the following steps: ... |
| 635 m_source->openIfInEndedState(); | 645 m_source->openIfInEndedState(); |
| 636 | 646 |
| 637 // Steps 4-5 of the prepare append algorithm are handled by m_webSourceBuffe r. | 647 // 4. Run the coded frame eviction algorithm. |
| 648 if (!evictCodedFrames()) { | |
| 649 // 5. If the buffer full flag equals true, then throw a QUOTA_EXCEEDED_ ERR exception and abort these steps. | |
| 650 // TODO(kjoswiak): Is this accurate? Are we actually appending data, or appending a data source? | |
|
philipj_slow
2014/12/10 09:28:26
No TODO(user) in Blink, just FIXME. Even better, i
kjoswiak
2014/12/10 19:11:45
whoops meant to remove this, I had actually come t
| |
| 651 exceptionState.throwDOMException(QuotaExceededError, "The SourceBuffer i s full, and cannot free space to append stream."); | |
| 652 return; | |
| 653 } | |
| 638 | 654 |
| 639 // 2. Set the updating attribute to true. | 655 // 2. Set the updating attribute to true. |
| 640 m_updating = true; | 656 m_updating = true; |
| 641 | 657 |
| 642 // 3. Queue a task to fire a simple event named updatestart at this SourceBu ffer object. | 658 // 3. Queue a task to fire a simple event named updatestart at this SourceBu ffer object. |
| 643 scheduleEvent(EventTypeNames::updatestart); | 659 scheduleEvent(EventTypeNames::updatestart); |
| 644 | 660 |
| 645 // 4. Asynchronously run the stream append loop algorithm with stream and ma xSize. | 661 // 4. Asynchronously run the stream append loop algorithm with stream and ma xSize. |
| 646 | 662 |
| 647 stream->neuter(); | 663 stream->neuter(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 744 | 760 |
| 745 void SourceBuffer::trace(Visitor* visitor) | 761 void SourceBuffer::trace(Visitor* visitor) |
| 746 { | 762 { |
| 747 visitor->trace(m_source); | 763 visitor->trace(m_source); |
| 748 visitor->trace(m_stream); | 764 visitor->trace(m_stream); |
| 749 visitor->trace(m_asyncEventQueue); | 765 visitor->trace(m_asyncEventQueue); |
| 750 EventTargetWithInlineData::trace(visitor); | 766 EventTargetWithInlineData::trace(visitor); |
| 751 } | 767 } |
| 752 | 768 |
| 753 } // namespace blink | 769 } // namespace blink |
| OLD | NEW |