Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp

Issue 2425463002: Improve HTMLMediaElement::currentTime() (Closed)
Patch Set: Merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 return false; 1150 return false;
1151 } 1151 }
1152 1152
1153 TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::prepareAppend", this); 1153 TRACE_EVENT_ASYNC_END0("media", "SourceBuffer::prepareAppend", this);
1154 return true; 1154 return true;
1155 } 1155 }
1156 1156
1157 bool SourceBuffer::evictCodedFrames(size_t newDataSize) { 1157 bool SourceBuffer::evictCodedFrames(size_t newDataSize) {
1158 DCHECK(m_source); 1158 DCHECK(m_source);
1159 DCHECK(m_source->mediaElement()); 1159 DCHECK(m_source->mediaElement());
1160
1161 // Nothing to do if the mediaElement does not yet have frames to evict.
1162 if (m_source->mediaElement()->getReadyState() <
1163 HTMLMediaElement::kHaveMetadata) {
1164 return true;
1165 }
1166
1160 double currentTime = m_source->mediaElement()->currentTime(); 1167 double currentTime = m_source->mediaElement()->currentTime();
1161 bool result = m_webSourceBuffer->evictCodedFrames(currentTime, newDataSize); 1168 bool result = m_webSourceBuffer->evictCodedFrames(currentTime, newDataSize);
1162 if (!result) { 1169 if (!result) {
1163 BLINK_SBLOG << __func__ << " this=" << this 1170 BLINK_SBLOG << __func__ << " this=" << this
1164 << " failed. newDataSize=" << newDataSize 1171 << " failed. newDataSize=" << newDataSize
1165 << " currentTime=" << currentTime << " buffered=" 1172 << " currentTime=" << currentTime << " buffered="
1166 << webTimeRangesToString(m_webSourceBuffer->buffered()); 1173 << webTimeRangesToString(m_webSourceBuffer->buffered());
1167 } 1174 }
1168 return result; 1175 return result;
1169 } 1176 }
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 visitor->trace(m_removeAsyncPartRunner); 1493 visitor->trace(m_removeAsyncPartRunner);
1487 visitor->trace(m_appendStreamAsyncPartRunner); 1494 visitor->trace(m_appendStreamAsyncPartRunner);
1488 visitor->trace(m_stream); 1495 visitor->trace(m_stream);
1489 visitor->trace(m_audioTracks); 1496 visitor->trace(m_audioTracks);
1490 visitor->trace(m_videoTracks); 1497 visitor->trace(m_videoTracks);
1491 EventTargetWithInlineData::trace(visitor); 1498 EventTargetWithInlineData::trace(visitor);
1492 ActiveDOMObject::trace(visitor); 1499 ActiveDOMObject::trace(visitor);
1493 } 1500 }
1494 1501
1495 } // namespace blink 1502 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698