Commit d0ebc15e authored by scherkus@chromium.org's avatar scherkus@chromium.org

Replace VideoRendererImpl's kError state with a CHECK().

If the process is unable to create a new thread we've got bigger issues
to deal with than reporting an error. A CHECK() will also give us
a sense for how often this happens in the wild.

BUG=110814

Review URL: https://codereview.chromium.org/276593007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269621 0039d316-1c4b-4281-b951-d872f2087c98
parent c8333331
...@@ -60,7 +60,7 @@ void VideoRendererImpl::Play(const base::Closure& callback) { ...@@ -60,7 +60,7 @@ void VideoRendererImpl::Play(const base::Closure& callback) {
void VideoRendererImpl::Pause(const base::Closure& callback) { void VideoRendererImpl::Pause(const base::Closure& callback) {
DCHECK(task_runner_->BelongsToCurrentThread()); DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_); base::AutoLock auto_lock(lock_);
DCHECK(state_ != kUninitialized || state_ == kError); DCHECK_NE(state_, kUninitialized);
state_ = kPaused; state_ = kPaused;
callback.Run(); callback.Run();
} }
...@@ -212,12 +212,7 @@ void VideoRendererImpl::OnVideoFrameStreamInitialized(bool success) { ...@@ -212,12 +212,7 @@ void VideoRendererImpl::OnVideoFrameStreamInitialized(bool success) {
state_ = kFlushed; state_ = kFlushed;
// Create our video thread. // Create our video thread.
if (!base::PlatformThread::Create(0, this, &thread_)) { CHECK(base::PlatformThread::Create(0, this, &thread_));
NOTREACHED() << "Video thread creation failed";
state_ = kError;
base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED);
return;
}
#if defined(OS_WIN) #if defined(OS_WIN)
// Bump up our priority so our sleeping is more accurate. // Bump up our priority so our sleeping is more accurate.
...@@ -363,7 +358,7 @@ void VideoRendererImpl::FrameReady(VideoFrameStream::Status status, ...@@ -363,7 +358,7 @@ void VideoRendererImpl::FrameReady(VideoFrameStream::Status status,
// Already-queued VideoFrameStream ReadCB's can fire after various state // Already-queued VideoFrameStream ReadCB's can fire after various state
// transitions have happened; in that case just drop those frames immediately. // transitions have happened; in that case just drop those frames immediately.
if (state_ == kStopped || state_ == kError || state_ == kFlushing) if (state_ == kStopped || state_ == kFlushing)
return; return;
if (!frame.get()) { if (!frame.get()) {
...@@ -468,7 +463,6 @@ void VideoRendererImpl::AttemptRead_Locked() { ...@@ -468,7 +463,6 @@ void VideoRendererImpl::AttemptRead_Locked() {
case kFlushing: case kFlushing:
case kFlushed: case kFlushed:
case kStopped: case kStopped:
case kError:
return; return;
} }
} }
......
...@@ -154,7 +154,7 @@ class MEDIA_EXPORT VideoRendererImpl ...@@ -154,7 +154,7 @@ class MEDIA_EXPORT VideoRendererImpl
base::ConditionVariable frame_available_; base::ConditionVariable frame_available_;
// State transition Diagram of this class: // State transition Diagram of this class:
// [kUninitialized] -------> [kError] // [kUninitialized]
// | // |
// | Initialize() // | Initialize()
// [kInitializing] // [kInitializing]
...@@ -173,7 +173,7 @@ class MEDIA_EXPORT VideoRendererImpl ...@@ -173,7 +173,7 @@ class MEDIA_EXPORT VideoRendererImpl
// | Pause() ^ Pause() // | Pause() ^ Pause()
// | | // | |
// +-----> [kStopped] [Any state other than] // +-----> [kStopped] [Any state other than]
// [kUninitialized/kError] // [ kUninitialized ]
// Simple state tracking variable. // Simple state tracking variable.
enum State { enum State {
...@@ -186,7 +186,6 @@ class MEDIA_EXPORT VideoRendererImpl ...@@ -186,7 +186,6 @@ class MEDIA_EXPORT VideoRendererImpl
kPrerolling, kPrerolling,
kPlaying, kPlaying,
kStopped, kStopped,
kError,
}; };
State state_; State state_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment