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

Unified Diff: media/filters/video_renderer_base.cc

Issue 12741012: base: Support setting thread priorities generically. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove static initializers. Created 7 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/audio/cross_process_notification_win.cc ('k') | remoting/base/auto_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/video_renderer_base.cc
diff --git a/media/filters/video_renderer_base.cc b/media/filters/video_renderer_base.cc
index f79e99df133d1a85df8865cec3a74a9a190ff5bf..84e48c4e64c2dca2537e1d23a7be25fd9c63dcec 100644
--- a/media/filters/video_renderer_base.cc
+++ b/media/filters/video_renderer_base.cc
@@ -35,7 +35,7 @@ VideoRendererBase::VideoRendererBase(
received_end_of_stream_(false),
frame_available_(&lock_),
state_(kUninitialized),
- thread_(base::kNullThreadHandle),
+ thread_(),
pending_read_(false),
drop_frames_(drop_frames),
playback_rate_(0),
@@ -48,7 +48,7 @@ VideoRendererBase::VideoRendererBase(
VideoRendererBase::~VideoRendererBase() {
base::AutoLock auto_lock(lock_);
CHECK(state_ == kStopped || state_ == kUninitialized) << state_;
- CHECK_EQ(thread_, base::kNullThreadHandle);
+ CHECK(thread_.is_null());
}
void VideoRendererBase::Play(const base::Closure& callback) {
@@ -100,15 +100,15 @@ void VideoRendererBase::Stop(const base::Closure& callback) {
DoStopOrError_Locked();
// Clean up our thread if present.
- base::PlatformThreadHandle thread_to_join = base::kNullThreadHandle;
- if (thread_ != base::kNullThreadHandle) {
+ base::PlatformThreadHandle thread_to_join = base::PlatformThreadHandle();
+ if (!thread_.is_null()) {
// Signal the thread since it's possible to get stopped with the video
// thread waiting for a read to complete.
frame_available_.Signal();
std::swap(thread_, thread_to_join);
}
- if (thread_to_join != base::kNullThreadHandle) {
+ if (!thread_to_join.is_null()) {
base::AutoUnlock auto_unlock(lock_);
base::PlatformThread::Join(thread_to_join);
}
@@ -212,7 +212,7 @@ void VideoRendererBase::OnVideoFrameStreamInitialized(bool success,
#if defined(OS_WIN)
// Bump up our priority so our sleeping is more accurate.
// TODO(scherkus): find out if this is necessary, but it seems to help.
- ::SetThreadPriority(thread_, THREAD_PRIORITY_ABOVE_NORMAL);
+ ::SetThreadPriority(thread_.platform_handle(), THREAD_PRIORITY_ABOVE_NORMAL);
#endif // defined(OS_WIN)
base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK);
}
« no previous file with comments | « media/audio/cross_process_notification_win.cc ('k') | remoting/base/auto_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698