Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/renderers/video_renderer_impl.h" | 5 #include "media/renderers/video_renderer_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 scoped_refptr<VideoFrame> result = | 179 scoped_refptr<VideoFrame> result = |
| 180 algorithm_->Render(deadline_min, deadline_max, &frames_dropped); | 180 algorithm_->Render(deadline_min, deadline_max, &frames_dropped); |
| 181 | 181 |
| 182 // Due to how the |algorithm_| holds frames, this should never be null if | 182 // Due to how the |algorithm_| holds frames, this should never be null if |
| 183 // we've had a proper startup sequence. | 183 // we've had a proper startup sequence. |
| 184 DCHECK(result); | 184 DCHECK(result); |
| 185 | 185 |
| 186 // Declare HAVE_NOTHING if we reach a state where we can't progress playback | 186 // Declare HAVE_NOTHING if we reach a state where we can't progress playback |
| 187 // any further. We don't want to do this if we've already done so, reached | 187 // any further. We don't want to do this if we've already done so, reached |
| 188 // end of stream, or have frames available. We also don't want to do this in | 188 // end of stream, or have frames available. We also don't want to do this in |
| 189 // background rendering mode unless this isn't the first background render | 189 // background rendering mode, as the frames aren't visible anyways. |
| 190 // tick and we haven't seen any decoded frames since the last one. | |
| 191 MaybeFireEndedCallback_Locked(true); | 190 MaybeFireEndedCallback_Locked(true); |
| 192 if (buffering_state_ == BUFFERING_HAVE_ENOUGH && !received_end_of_stream_ && | 191 if (buffering_state_ == BUFFERING_HAVE_ENOUGH && !received_end_of_stream_ && |
| 193 !algorithm_->effective_frames_queued() && | 192 !algorithm_->effective_frames_queued() && !background_rendering && |
| 194 (!background_rendering || | 193 !was_background_rendering_) { |
|
chcunningham
2016/09/09 21:27:06
So, IIUC this is just giving us one more tick to g
DaleCurtis
2016/09/09 21:51:41
Yes, because whenever the previous state was reach
chcunningham
2016/09/09 22:17:46
You're saying that every time we will *never* have
DaleCurtis
2016/09/09 22:20:46
I mean every time we get into a state where we wer
| |
| 195 (!frames_decoded_ && was_background_rendering_))) { | |
| 196 // Do not set |buffering_state_| here as the lock in FrameReady() may be | 194 // Do not set |buffering_state_| here as the lock in FrameReady() may be |
| 197 // held already and it fire the state changes in the wrong order. | 195 // held already and it fire the state changes in the wrong order. |
| 198 DVLOG(3) << __func__ << " posted TransitionToHaveNothing."; | 196 DVLOG(3) << __func__ << " posted TransitionToHaveNothing."; |
| 199 task_runner_->PostTask( | 197 task_runner_->PostTask( |
| 200 FROM_HERE, base::Bind(&VideoRendererImpl::TransitionToHaveNothing, | 198 FROM_HERE, base::Bind(&VideoRendererImpl::TransitionToHaveNothing, |
| 201 weak_factory_.GetWeakPtr())); | 199 weak_factory_.GetWeakPtr())); |
| 202 } | 200 } |
| 203 | 201 |
| 204 // We don't count dropped frames in the background to avoid skewing the count | 202 // We don't count dropped frames in the background to avoid skewing the count |
| 205 // and impacting JavaScript visible metrics used by web developers. | 203 // and impacting JavaScript visible metrics used by web developers. |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 684 | 682 |
| 685 void VideoRendererImpl::AttemptReadAndCheckForMetadataChanges( | 683 void VideoRendererImpl::AttemptReadAndCheckForMetadataChanges( |
| 686 VideoPixelFormat pixel_format, | 684 VideoPixelFormat pixel_format, |
| 687 const gfx::Size& natural_size) { | 685 const gfx::Size& natural_size) { |
| 688 base::AutoLock auto_lock(lock_); | 686 base::AutoLock auto_lock(lock_); |
| 689 CheckForMetadataChanges(pixel_format, natural_size); | 687 CheckForMetadataChanges(pixel_format, natural_size); |
| 690 AttemptRead_Locked(); | 688 AttemptRead_Locked(); |
| 691 } | 689 } |
| 692 | 690 |
| 693 } // namespace media | 691 } // namespace media |
| OLD | NEW |