OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 * 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 // quantumStartFrame : Start frame of the current time quantum. | 66 // quantumStartFrame : Start frame of the current time quantum. |
67 // quantumEndFrame : End frame of the current time quantum. | 67 // quantumEndFrame : End frame of the current time quantum. |
68 // startFrame : Start frame for this source. | 68 // startFrame : Start frame for this source. |
69 // endFrame : End frame for this source. | 69 // endFrame : End frame for this source. |
70 size_t quantumStartFrame = context()->currentSampleFrame(); | 70 size_t quantumStartFrame = context()->currentSampleFrame(); |
71 size_t quantumEndFrame = quantumStartFrame + quantumFrameSize; | 71 size_t quantumEndFrame = quantumStartFrame + quantumFrameSize; |
72 size_t startFrame = | 72 size_t startFrame = |
73 AudioUtilities::timeToSampleFrame(m_startTime, sampleRate); | 73 AudioUtilities::timeToSampleFrame(m_startTime, sampleRate); |
74 size_t endFrame = | 74 size_t endFrame = |
75 m_endTime == UnknownTime ? 0 : AudioUtilities::timeToSampleFrame( | 75 m_endTime == UnknownTime |
76 m_endTime, sampleRate); | 76 ? 0 |
| 77 : AudioUtilities::timeToSampleFrame(m_endTime, sampleRate); |
77 | 78 |
78 // If we know the end time and it's already passed, then don't bother doing | 79 // If we know the end time and it's already passed, then don't bother doing |
79 // any more rendering this cycle. | 80 // any more rendering this cycle. |
80 if (m_endTime != UnknownTime && endFrame <= quantumStartFrame) | 81 if (m_endTime != UnknownTime && endFrame <= quantumStartFrame) |
81 finish(); | 82 finish(); |
82 | 83 |
83 PlaybackState state = playbackState(); | 84 PlaybackState state = playbackState(); |
84 | 85 |
85 if (state == UNSCHEDULED_STATE || state == FINISHED_STATE || | 86 if (state == UNSCHEDULED_STATE || state == FINISHED_STATE || |
86 startFrame >= quantumEndFrame) { | 87 startFrame >= quantumEndFrame) { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // playback state if the context is closed. | 281 // playback state if the context is closed. |
281 if (context()->isContextClosed()) | 282 if (context()->isContextClosed()) |
282 return false; | 283 return false; |
283 | 284 |
284 // If a node is scheduled or playing, do not collect the node prematurely | 285 // If a node is scheduled or playing, do not collect the node prematurely |
285 // even its reference is out of scope. Then fire onended event if assigned. | 286 // even its reference is out of scope. Then fire onended event if assigned. |
286 return audioScheduledSourceHandler().isPlayingOrScheduled(); | 287 return audioScheduledSourceHandler().isPlayingOrScheduled(); |
287 } | 288 } |
288 | 289 |
289 } // namespace blink | 290 } // namespace blink |
OLD | NEW |