Index: content/common/gpu/media/dxva_video_decode_accelerator.cc |
diff --git a/content/common/gpu/media/dxva_video_decode_accelerator.cc b/content/common/gpu/media/dxva_video_decode_accelerator.cc |
index 9ac0f0defdebee4185e213c55add706bc2b9b3b5..fba93896726c3e60b8da39147c61d65b02ddb1a3 100644 |
--- a/content/common/gpu/media/dxva_video_decode_accelerator.cc |
+++ b/content/common/gpu/media/dxva_video_decode_accelerator.cc |
@@ -1456,27 +1456,25 @@ void DXVAVideoDecodeAccelerator::DeferredDismissStaleBuffer( |
stale_output_picture_buffers_.erase(it); |
} |
-DXVAVideoDecodeAccelerator::State |
-DXVAVideoDecodeAccelerator::GetState() const { |
- State state = kUninitialized; |
- ::InterlockedExchange(reinterpret_cast<long*>(&state), |
- state_); |
- return state; |
-} |
- |
-void DXVAVideoDecodeAccelerator::SetState(State new_state) { |
- if (!main_thread_task_runner_->BelongsToCurrentThread()) { |
- main_thread_task_runner_->PostTask( |
- FROM_HERE, |
- base::Bind(&DXVAVideoDecodeAccelerator::SetState, |
- weak_this_factory_.GetWeakPtr(), |
- new_state)); |
- return; |
- } |
- ::InterlockedCompareExchange(reinterpret_cast<long*>(&state_), |
- new_state, |
- state_); |
- DCHECK_EQ(state_, new_state); |
+DXVAVideoDecodeAccelerator::State |
+DXVAVideoDecodeAccelerator::GetState() { |
+ State state = static_cast<State>( |
+ InterlockedAdd(reinterpret_cast<volatile long*>(&state_), 0)); |
brucedawson
2014/12/12 18:56:29
When doing a reinterpret_cast between State* and l
ananta
2014/12/12 19:59:07
Done.
|
+ return state; |
+} |
+ |
+void DXVAVideoDecodeAccelerator::SetState(State new_state) { |
+ if (!main_thread_task_runner_->BelongsToCurrentThread()) { |
+ main_thread_task_runner_->PostTask( |
+ FROM_HERE, |
+ base::Bind(&DXVAVideoDecodeAccelerator::SetState, |
+ weak_this_factory_.GetWeakPtr(), |
+ new_state)); |
+ return; |
+ } |
+ ::InterlockedExchange(reinterpret_cast<volatile long*>(&state_), |
+ new_state); |
+ DCHECK_EQ(state_, new_state); |
} |
void DXVAVideoDecodeAccelerator::StartDecoderThread() { |