| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 106     // 1. If activeSourceBuffers.length equals 0 then return an empty TimeRanges
      object and abort these steps. | 106     // 1. If activeSourceBuffers.length equals 0 then return an empty TimeRanges
      object and abort these steps. | 
| 107     if (ranges.isEmpty()) | 107     if (ranges.isEmpty()) | 
| 108         return TimeRanges::create(); | 108         return TimeRanges::create(); | 
| 109 | 109 | 
| 110     // 2. Let active ranges be the ranges returned by buffered for each SourceBu
     ffer object in activeSourceBuffers. | 110     // 2. Let active ranges be the ranges returned by buffered for each SourceBu
     ffer object in activeSourceBuffers. | 
| 111     // 3. Let highest end time be the largest range end time in the active range
     s. | 111     // 3. Let highest end time be the largest range end time in the active range
     s. | 
| 112     double highestEndTime = -1; | 112     double highestEndTime = -1; | 
| 113     for (size_t i = 0; i < ranges.size(); ++i) { | 113     for (size_t i = 0; i < ranges.size(); ++i) { | 
| 114         unsigned length = ranges[i]->length(); | 114         unsigned length = ranges[i]->length(); | 
| 115         if (length) | 115         if (length) | 
| 116             highestEndTime = std::max(highestEndTime, ranges[i]->end(length - 1,
      ASSERT_NO_EXCEPTION_STATE)); | 116             highestEndTime = std::max(highestEndTime, ranges[i]->end(length - 1,
      ASSERT_NO_EXCEPTION)); | 
| 117     } | 117     } | 
| 118 | 118 | 
| 119     // Return an empty range if all ranges are empty. | 119     // Return an empty range if all ranges are empty. | 
| 120     if (highestEndTime < 0) | 120     if (highestEndTime < 0) | 
| 121         return TimeRanges::create(); | 121         return TimeRanges::create(); | 
| 122 | 122 | 
| 123     // 4. Let intersection ranges equal a TimeRange object containing a single r
     ange from 0 to highest end time. | 123     // 4. Let intersection ranges equal a TimeRange object containing a single r
     ange from 0 to highest end time. | 
| 124     RefPtr<TimeRanges> intersectionRanges = TimeRanges::create(0, highestEndTime
     ); | 124     RefPtr<TimeRanges> intersectionRanges = TimeRanges::create(0, highestEndTime
     ); | 
| 125 | 125 | 
| 126     // 5. For each SourceBuffer object in activeSourceBuffers run the following 
     steps: | 126     // 5. For each SourceBuffer object in activeSourceBuffers run the following 
     steps: | 
| 127     bool ended = readyState() == endedKeyword(); | 127     bool ended = readyState() == endedKeyword(); | 
| 128     for (size_t i = 0; i < ranges.size(); ++i) { | 128     for (size_t i = 0; i < ranges.size(); ++i) { | 
| 129         // 5.1 Let source ranges equal the ranges returned by the buffered attri
     bute on the current SourceBuffer. | 129         // 5.1 Let source ranges equal the ranges returned by the buffered attri
     bute on the current SourceBuffer. | 
| 130         TimeRanges* sourceRanges = ranges[i].get(); | 130         TimeRanges* sourceRanges = ranges[i].get(); | 
| 131 | 131 | 
| 132         // 5.2 If readyState is "ended", then set the end time on the last range
      in source ranges to highest end time. | 132         // 5.2 If readyState is "ended", then set the end time on the last range
      in source ranges to highest end time. | 
| 133         if (ended && sourceRanges->length()) | 133         if (ended && sourceRanges->length()) | 
| 134             sourceRanges->add(sourceRanges->start(sourceRanges->length() - 1, AS
     SERT_NO_EXCEPTION_STATE), highestEndTime); | 134             sourceRanges->add(sourceRanges->start(sourceRanges->length() - 1, AS
     SERT_NO_EXCEPTION), highestEndTime); | 
| 135 | 135 | 
| 136         // 5.3 Let new intersection ranges equal the the intersection between th
     e intersection ranges and the source ranges. | 136         // 5.3 Let new intersection ranges equal the the intersection between th
     e intersection ranges and the source ranges. | 
| 137         // 5.4 Replace the ranges in intersection ranges with the new intersecti
     on ranges. | 137         // 5.4 Replace the ranges in intersection ranges with the new intersecti
     on ranges. | 
| 138         intersectionRanges->intersectWith(sourceRanges); | 138         intersectionRanges->intersectWith(sourceRanges); | 
| 139     } | 139     } | 
| 140 | 140 | 
| 141     return intersectionRanges.release(); | 141     return intersectionRanges.release(); | 
| 142 } | 142 } | 
| 143 | 143 | 
| 144 void MediaSourceBase::setDuration(double duration, ExceptionState& es) | 144 void MediaSourceBase::setDuration(double duration, ExceptionState& es) | 
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 305 { | 305 { | 
| 306     return &m_eventTargetData; | 306     return &m_eventTargetData; | 
| 307 } | 307 } | 
| 308 | 308 | 
| 309 URLRegistry& MediaSourceBase::registry() const | 309 URLRegistry& MediaSourceBase::registry() const | 
| 310 { | 310 { | 
| 311     return MediaSourceRegistry::registry(); | 311     return MediaSourceRegistry::registry(); | 
| 312 } | 312 } | 
| 313 | 313 | 
| 314 } | 314 } | 
| OLD | NEW | 
|---|