Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 850 // Optimize the case where the last event is in the past. | 850 // Optimize the case where the last event is in the past. |
| 851 ParamEvent* lastEvent = m_events[m_events.size() - 1].get(); | 851 ParamEvent* lastEvent = m_events[m_events.size() - 1].get(); |
| 852 ParamEvent::Type lastEventType = lastEvent->getType(); | 852 ParamEvent::Type lastEventType = lastEvent->getType(); |
| 853 double lastEventTime = lastEvent->time(); | 853 double lastEventTime = lastEvent->time(); |
| 854 | 854 |
| 855 // If the last event is in the past and the event has ended, then we can | 855 // If the last event is in the past and the event has ended, then we can |
| 856 // just propagate the same value. Except for SetTarget which lasts | 856 // just propagate the same value. Except for SetTarget which lasts |
| 857 // "forever". SetValueCurve also has an explicit SetValue at the end of | 857 // "forever". SetValueCurve also has an explicit SetValue at the end of |
| 858 // the curve, so we don't need to worry that SetValueCurve time is a | 858 // the curve, so we don't need to worry that SetValueCurve time is a |
| 859 // start time, not an end time. | 859 // start time, not an end time. |
| 860 if (lastEventTime < currentTime && lastEventType != ParamEvent::SetTarget) { | 860 // |
| 861 // Allow at least one render quantum to go by before handling this | |
| 862 // to allow k-rate parameters to finish processing the event. See | |
| 863 // crbug.com/672857. Due to possible roundoff, arbirtrarily wait | |
| 864 // for 1.5 render quanta instead of 1. | |
|
hongchan
2017/01/12 23:32:16
What is the possible side effect of waiting 1.5 RQ
Raymond Toy
2017/01/12 23:49:10
I think the only side-effect would be that we now
| |
| 865 if (lastEventTime + | |
| 866 1.5 * AudioUtilities::kRenderQuantumFrames / sampleRate < | |
| 867 currentTime && | |
| 868 lastEventType != ParamEvent::SetTarget) { | |
|
hongchan
2017/01/12 23:32:15
Wow. Is this what 'git cl format' offers? Could yo
Raymond Toy
2017/01/12 23:46:51
Yep. This isn't how I had originally indented it.
| |
| 861 // The event has finished, so just copy the default value out. | 869 // The event has finished, so just copy the default value out. |
| 862 // Since all events are now also in the past, we can just remove all | 870 // Since all events are now also in the past, we can just remove all |
| 863 // timeline events too because |defaultValue| has the expected | 871 // timeline events too because |defaultValue| has the expected |
| 864 // value. | 872 // value. |
| 865 for (unsigned i = 0; i < numberOfValues; ++i) | 873 for (unsigned i = 0; i < numberOfValues; ++i) |
| 866 values[i] = defaultValue; | 874 values[i] = defaultValue; |
| 867 m_smoothedValue = defaultValue; | 875 m_smoothedValue = defaultValue; |
| 868 m_events.clear(); | 876 m_events.clear(); |
| 869 return defaultValue; | 877 return defaultValue; |
| 870 } | 878 } |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1562 // propagate the last value to the end of the values buffer. | 1570 // propagate the last value to the end of the values buffer. |
| 1563 for (; writeIndex < numberOfValues; ++writeIndex) | 1571 for (; writeIndex < numberOfValues; ++writeIndex) |
| 1564 values[writeIndex] = value; | 1572 values[writeIndex] = value; |
| 1565 | 1573 |
| 1566 // This value is used to set the .value attribute of the AudioParam. it | 1574 // This value is used to set the .value attribute of the AudioParam. it |
| 1567 // should be the last computed value. | 1575 // should be the last computed value. |
| 1568 return values[numberOfValues - 1]; | 1576 return values[numberOfValues - 1]; |
| 1569 } | 1577 } |
| 1570 | 1578 |
| 1571 } // namespace blink | 1579 } // namespace blink |
| OLD | NEW |