OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/threading/platform_thread.h" | 7 #include "base/threading/platform_thread.h" |
8 #include "media/base/buffers.h" | 8 #include "media/base/buffers.h" |
9 #include "media/base/filter_host.h" | 9 #include "media/base/filter_host.h" |
10 #include "media/base/limits.h" | 10 #include "media/base/limits.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 // frame when this is true. | 329 // frame when this is true. |
330 frame_available_.Signal(); | 330 frame_available_.Signal(); |
331 if (state_ == kFlushing) { | 331 if (state_ == kFlushing) { |
332 AttemptFlush_Locked(); | 332 AttemptFlush_Locked(); |
333 } else if (state_ == kError || state_ == kStopped) { | 333 } else if (state_ == kError || state_ == kStopped) { |
334 DoStopOrError_Locked(); | 334 DoStopOrError_Locked(); |
335 } | 335 } |
336 } | 336 } |
337 | 337 |
338 void VideoRendererBase::FrameReady(scoped_refptr<VideoFrame> frame) { | 338 void VideoRendererBase::FrameReady(scoped_refptr<VideoFrame> frame) { |
339 DCHECK(frame); | |
340 | |
341 base::AutoLock auto_lock(lock_); | 339 base::AutoLock auto_lock(lock_); |
342 DCHECK_NE(state_, kUninitialized); | 340 DCHECK_NE(state_, kUninitialized); |
343 DCHECK_NE(state_, kStopped); | 341 DCHECK_NE(state_, kStopped); |
344 DCHECK_NE(state_, kError); | 342 DCHECK_NE(state_, kError); |
345 DCHECK_NE(state_, kFlushed); | 343 DCHECK_NE(state_, kFlushed); |
346 CHECK(pending_read_); | 344 CHECK(pending_read_); |
347 | 345 |
348 pending_read_ = false; | 346 pending_read_ = false; |
349 | 347 |
350 if (state_ == kFlushing) { | 348 if (state_ == kFlushing) { |
351 AttemptFlush_Locked(); | 349 AttemptFlush_Locked(); |
352 return; | 350 return; |
353 } | 351 } |
354 | 352 |
353 if (!frame) { | |
Ami GONE FROM CHROMIUM
2012/01/29 22:12:38
I thought this test encompassed the entire remaind
acolwell GONE FROM CHROMIUM
2012/01/30 00:14:14
I believe so. Getting a NULL frame means that the
| |
354 if (state_ != kSeeking) | |
355 return; | |
356 | |
357 state_ = kPrerolled; | |
358 ResetAndRunCB(&seek_cb_, PIPELINE_OK); | |
359 return; | |
360 } | |
361 | |
355 // Discard frames until we reach our desired seek timestamp. | 362 // Discard frames until we reach our desired seek timestamp. |
356 if (state_ == kSeeking && !frame->IsEndOfStream() && | 363 if (state_ == kSeeking && !frame->IsEndOfStream() && |
357 (frame->GetTimestamp() + frame->GetDuration()) <= seek_timestamp_) { | 364 (frame->GetTimestamp() + frame->GetDuration()) <= seek_timestamp_) { |
358 AttemptRead_Locked(); | 365 AttemptRead_Locked(); |
359 return; | 366 return; |
360 } | 367 } |
361 | 368 |
362 // Adjust the incoming frame if its rendering stop time is past the duration | 369 // Adjust the incoming frame if its rendering stop time is past the duration |
363 // of the video itself. This is typically the last frame of the video and | 370 // of the video itself. This is typically the last frame of the video and |
364 // occurs if the container specifies a duration that isn't a multiple of the | 371 // occurs if the container specifies a duration that isn't a multiple of the |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 | 477 |
471 int VideoRendererBase::NumFrames_Locked() const { | 478 int VideoRendererBase::NumFrames_Locked() const { |
472 lock_.AssertAcquired(); | 479 lock_.AssertAcquired(); |
473 int outstanding_frames = | 480 int outstanding_frames = |
474 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + | 481 (current_frame_ ? 1 : 0) + (last_available_frame_ ? 1 : 0) + |
475 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); | 482 (current_frame_ && (current_frame_ == last_available_frame_) ? -1 : 0); |
476 return ready_frames_.size() + outstanding_frames; | 483 return ready_frames_.size() + outstanding_frames; |
477 } | 484 } |
478 | 485 |
479 } // namespace media | 486 } // namespace media |
OLD | NEW |