Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: media/filters/video_thread.cc

Issue 113611: Handle end of stream for media... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/video_renderer_base.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « media/filters/video_renderer_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698