Index: media/filters/video_thread.cc |
=================================================================== |
--- media/filters/video_thread.cc (revision 17376) |
+++ media/filters/video_thread.cc (working copy) |
@@ -163,6 +163,7 @@ |
frames_.pop_front(); |
ScheduleRead(); |
while (frames_.empty()) { |
+ |
scherkus (not reviewing)
2009/06/04 20:11:08
remove empty line
Alpha Left Google
2009/06/04 20:13:34
Done.
|
frame_available_.Wait(); |
// We have the lock again, check the actual state to see if we're trying |
@@ -228,17 +229,26 @@ |
void VideoThread::OnReadComplete(VideoFrame* frame) { |
AutoLock auto_lock(lock_); |
- frames_.push_back(frame); |
- DCHECK_LE(frames_.size(), kMaxFrames); |
+ // If this is an end of stream frame, don't enqueue it since it has no data. |
+ if (!frame->IsEndOfStream()) { |
+ frames_.push_back(frame); |
+ DCHECK_LE(frames_.size(), kMaxFrames); |
+ frame_available_.Signal(); |
+ } |
// Check for our initialization condition. |
- if (state_ == INITIALIZING && frames_.size() == kMaxFrames) { |
- state_ = INITIALIZED; |
- current_frame_ = frames_.front(); |
- host_->InitializationComplete(); |
+ if (state_ == INITIALIZING && |
+ (frames_.size() == kMaxFrames || frame->IsEndOfStream())) { |
+ if (frames_.empty()) { |
+ // We should have initialized but there's no decoded frames in the queue. |
+ // Raise an error. |
+ host_->Error(PIPELINE_ERROR_NO_DATA); |
+ } else { |
+ state_ = INITIALIZED; |
+ current_frame_ = frames_.front(); |
+ host_->InitializationComplete(); |
+ } |
} |
- |
- frame_available_.Signal(); |
} |
void VideoThread::ScheduleRead() { |