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

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 235953010: Resolve the issue of unexpected currentTime values when setting currentTime from seeking event (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@mediaposter
Patch Set: Added new line in the expected output to match the test case Created 6 years, 8 months 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 | « LayoutTests/media/video-double-seek-currentTime-expected.txt ('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) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 refreshCachedTime(); 1710 refreshCachedTime();
1711 double now = currentTime(); 1711 double now = currentTime();
1712 1712
1713 // 2 - If the element's seeking IDL attribute is true, then another instance of this algorithm is 1713 // 2 - If the element's seeking IDL attribute is true, then another instance of this algorithm is
1714 // already running. Abort that other instance of the algorithm without waiti ng for the step that 1714 // already running. Abort that other instance of the algorithm without waiti ng for the step that
1715 // it is running to complete. 1715 // it is running to complete.
1716 // Nothing specific to be done here. 1716 // Nothing specific to be done here.
1717 1717
1718 // 3 - Set the seeking IDL attribute to true. 1718 // 3 - Set the seeking IDL attribute to true.
1719 // The flag will be cleared when the engine tells us the time has actually c hanged. 1719 // The flag will be cleared when the engine tells us the time has actually c hanged.
1720 bool previousSeekStillPending = m_seeking;
1720 m_seeking = true; 1721 m_seeking = true;
1721 1722
1722 // 5 - If the new playback position is later than the end of the media resou rce, then let it be the end 1723 // 5 - If the new playback position is later than the end of the media resou rce, then let it be the end
1723 // of the media resource instead. 1724 // of the media resource instead.
1724 time = min(time, duration()); 1725 time = min(time, duration());
1725 1726
1726 // 6 - If the new playback position is less than the earliest possible posit ion, let it be that position instead. 1727 // 6 - If the new playback position is less than the earliest possible posit ion, let it be that position instead.
1727 time = max(time, 0.0); 1728 time = max(time, 0.0);
1728 1729
1729 // Ask the media engine for the time value in the movie's time scale before comparing with current time. This 1730 // Ask the media engine for the time value in the movie's time scale before comparing with current time. This
(...skipping 20 matching lines...) Expand all
1750 bool noSeekRequired = !seekableRanges->length() || (time == now && displayMo de() != Poster); 1751 bool noSeekRequired = !seekableRanges->length() || (time == now && displayMo de() != Poster);
1751 1752
1752 // Always notify the media engine of a seek if the source is not closed. Thi s ensures that the source is 1753 // Always notify the media engine of a seek if the source is not closed. Thi s ensures that the source is
1753 // always in a flushed state when the 'seeking' event fires. 1754 // always in a flushed state when the 'seeking' event fires.
1754 if (m_mediaSource && m_mediaSource->isClosed()) 1755 if (m_mediaSource && m_mediaSource->isClosed())
1755 noSeekRequired = false; 1756 noSeekRequired = false;
1756 1757
1757 if (noSeekRequired) { 1758 if (noSeekRequired) {
1758 if (time == now) { 1759 if (time == now) {
1759 scheduleEvent(EventTypeNames::seeking); 1760 scheduleEvent(EventTypeNames::seeking);
1761 if (previousSeekStillPending)
1762 return;
1760 // FIXME: There must be a stable state before timeupdate+seeked are dispatched and seeking 1763 // FIXME: There must be a stable state before timeupdate+seeked are dispatched and seeking
1761 // is reset to false. See http://crbug.com/266631 1764 // is reset to false. See http://crbug.com/266631
1762 scheduleTimeupdateEvent(false); 1765 scheduleTimeupdateEvent(false);
1763 scheduleEvent(EventTypeNames::seeked); 1766 scheduleEvent(EventTypeNames::seeked);
1764 } 1767 }
1765 m_seeking = false; 1768 m_seeking = false;
1766 return; 1769 return;
1767 } 1770 }
1768 time = seekableRanges->nearest(time); 1771 time = seekableRanges->nearest(time);
1769 1772
(...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after
3642 return fastHasAttribute(controlsAttr); 3645 return fastHasAttribute(controlsAttr);
3643 } 3646 }
3644 3647
3645 void HTMLMediaElement::trace(Visitor* visitor) 3648 void HTMLMediaElement::trace(Visitor* visitor)
3646 { 3649 {
3647 Supplementable<HTMLMediaElement>::trace(visitor); 3650 Supplementable<HTMLMediaElement>::trace(visitor);
3648 HTMLElement::trace(visitor); 3651 HTMLElement::trace(visitor);
3649 } 3652 }
3650 3653
3651 } 3654 }
OLDNEW
« no previous file with comments | « LayoutTests/media/video-double-seek-currentTime-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698