| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 | 359 |
| 360 return intersectionRanges.release(); | 360 return intersectionRanges.release(); |
| 361 } | 361 } |
| 362 | 362 |
| 363 PassRefPtrWillBeRawPtr<TimeRanges> MediaSource::seekable() const | 363 PassRefPtrWillBeRawPtr<TimeRanges> MediaSource::seekable() const |
| 364 { | 364 { |
| 365 // Implements MediaSource algorithm for HTMLMediaElement.seekable. | 365 // Implements MediaSource algorithm for HTMLMediaElement.seekable. |
| 366 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#htmlmediaelement-extensions | 366 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#htmlmediaelement-extensions |
| 367 | 367 |
| 368 double sourceDuration = duration(); | 368 double sourceDuration = duration(); |
| 369 // 1. If duration equals NaN then return an empty TimeRanges object. | 369 // If duration equals NaN: Return an empty TimeRanges object. |
| 370 if (std::isnan(sourceDuration)) | 370 if (std::isnan(sourceDuration)) |
| 371 return TimeRanges::create(); | 371 return TimeRanges::create(); |
| 372 | 372 |
| 373 // 2. If duration equals positive Infinity, then return a single range with
a start time of 0 and an end time equal to the | 373 // If duration equals positive Infinity: |
| 374 // highest end time reported by the HTMLMediaElement.buffered attribute. | |
| 375 if (sourceDuration == std::numeric_limits<double>::infinity()) { | 374 if (sourceDuration == std::numeric_limits<double>::infinity()) { |
| 376 RefPtrWillBeRawPtr<TimeRanges> buffered = m_attachedElement->buffered(); | 375 RefPtrWillBeRawPtr<TimeRanges> buffered = m_attachedElement->buffered(); |
| 376 |
| 377 // 1. If the HTMLMediaElement.buffered attribute returns an empty TimeRa
nges object, then |
| 378 // return an empty TimeRanges object and abort these steps. |
| 377 if (buffered->length() == 0) | 379 if (buffered->length() == 0) |
| 378 return TimeRanges::create(); | 380 return TimeRanges::create(); |
| 381 |
| 382 // 2. Return a single range with a start time of 0 and an end time equal
to the highest end |
| 383 // time reported by the HTMLMediaElement.buffered attribute. |
| 379 return TimeRanges::create(0, buffered->end(buffered->length() - 1, ASSER
T_NO_EXCEPTION)); | 384 return TimeRanges::create(0, buffered->end(buffered->length() - 1, ASSER
T_NO_EXCEPTION)); |
| 380 } | 385 } |
| 381 | 386 |
| 382 // 3. Otherwise, return a single range with a start time of 0 and an end tim
e equal to duration. | 387 // 3. Otherwise: Return a single range with a start time of 0 and an end tim
e equal to duration. |
| 383 return TimeRanges::create(0, sourceDuration); | 388 return TimeRanges::create(0, sourceDuration); |
| 384 } | 389 } |
| 385 | 390 |
| 386 void MediaSource::setDuration(double duration, ExceptionState& exceptionState) | 391 void MediaSource::setDuration(double duration, ExceptionState& exceptionState) |
| 387 { | 392 { |
| 388 // 2.1 http://www.w3.org/TR/media-source/#widl-MediaSource-duration | 393 // 2.1 http://www.w3.org/TR/media-source/#widl-MediaSource-duration |
| 389 // 1. If the value being set is negative or NaN then throw an InvalidAccessE
rror | 394 // 1. If the value being set is negative or NaN then throw an InvalidAccessE
rror |
| 390 // exception and abort these steps. | 395 // exception and abort these steps. |
| 391 if (std::isnan(duration)) { | 396 if (std::isnan(duration)) { |
| 392 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
notAFiniteNumber(duration, "duration")); | 397 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
notAFiniteNumber(duration, "duration")); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 612 |
| 608 m_asyncEventQueue->enqueueEvent(event.release()); | 613 m_asyncEventQueue->enqueueEvent(event.release()); |
| 609 } | 614 } |
| 610 | 615 |
| 611 URLRegistry& MediaSource::registry() const | 616 URLRegistry& MediaSource::registry() const |
| 612 { | 617 { |
| 613 return MediaSourceRegistry::registry(); | 618 return MediaSourceRegistry::registry(); |
| 614 } | 619 } |
| 615 | 620 |
| 616 } // namespace blink | 621 } // namespace blink |
| OLD | NEW |