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

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

Issue 2581533002: MSE: Fix logic bugs with high precision duration (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 seek(time); 1999 seek(time);
2000 } 2000 }
2001 2001
2002 double HTMLMediaElement::duration() const { 2002 double HTMLMediaElement::duration() const {
2003 // FIXME: remove m_webMediaPlayer check once we figure out how 2003 // FIXME: remove m_webMediaPlayer check once we figure out how
2004 // m_webMediaPlayer is going out of sync with readystate. 2004 // m_webMediaPlayer is going out of sync with readystate.
2005 // m_webMediaPlayer is cleared but readystate is not set to kHaveNothing. 2005 // m_webMediaPlayer is cleared but readystate is not set to kHaveNothing.
2006 if (!m_webMediaPlayer || m_readyState < kHaveMetadata) 2006 if (!m_webMediaPlayer || m_readyState < kHaveMetadata)
2007 return std::numeric_limits<double>::quiet_NaN(); 2007 return std::numeric_limits<double>::quiet_NaN();
2008 2008
2009 // FIXME: Refactor so m_duration is kept current (in both MSE and
2010 // non-MSE cases) once we have transitioned from kHaveNothing ->
2011 // kHaveMetadata. Currently, m_duration may be out of date for at least MSE
2012 // case because MediaSource and SourceBuffer do not notify the element
2013 // directly upon duration changes caused by endOfStream, remove, or append
2014 // operations; rather the notification is triggered by the WebMediaPlayer
2015 // implementation observing that the underlying engine has updated duration
2016 // and notifying the element to consult its MediaSource for current
2017 // duration. See http://crbug.com/266644
chcunningham 2016/12/15 01:24:26 Matt, I think this comment is stale (or I misunder
wolenetz 2016/12/16 00:56:52 These do eventually bubble, but in the interim tim
chcunningham 2017/01/03 17:48:06 At this point m_duration is only used in OnDuratio
2018
2019 if (m_mediaSource) 2009 if (m_mediaSource)
2020 return m_mediaSource->duration(); 2010 return m_mediaSource->duration();
2021 2011
2022 return webMediaPlayer()->duration(); 2012 return webMediaPlayer()->duration();
2023 } 2013 }
2024 2014
2025 bool HTMLMediaElement::paused() const { 2015 bool HTMLMediaElement::paused() const {
2026 return m_paused; 2016 return m_paused;
2027 } 2017 }
2028 2018
(...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after
4094 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); 4084 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE);
4095 } 4085 }
4096 4086
4097 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { 4087 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) {
4098 m_mostlyFillingViewport = true; 4088 m_mostlyFillingViewport = true;
4099 if (m_webMediaPlayer) 4089 if (m_webMediaPlayer)
4100 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); 4090 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport);
4101 } 4091 }
4102 4092
4103 } // namespace blink 4093 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698