OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
6 | 6 |
7 #if !defined(OS_WIN) | 7 #if !defined(OS_WIN) |
8 #error This file should only be built on Windows. | 8 #error This file should only be built on Windows. |
9 #endif // !defined(OS_WIN) | 9 #endif // !defined(OS_WIN) |
10 | 10 |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1450 int32 picture_buffer_id) { | 1450 int32 picture_buffer_id) { |
1451 OutputBuffers::iterator it = stale_output_picture_buffers_.find( | 1451 OutputBuffers::iterator it = stale_output_picture_buffers_.find( |
1452 picture_buffer_id); | 1452 picture_buffer_id); |
1453 DCHECK(it != stale_output_picture_buffers_.end()); | 1453 DCHECK(it != stale_output_picture_buffers_.end()); |
1454 DVLOG(1) << "Dismissing picture id: " << it->second->id(); | 1454 DVLOG(1) << "Dismissing picture id: " << it->second->id(); |
1455 client_->DismissPictureBuffer(it->second->id()); | 1455 client_->DismissPictureBuffer(it->second->id()); |
1456 stale_output_picture_buffers_.erase(it); | 1456 stale_output_picture_buffers_.erase(it); |
1457 } | 1457 } |
1458 | 1458 |
1459 DXVAVideoDecodeAccelerator::State | 1459 DXVAVideoDecodeAccelerator::State |
1460 DXVAVideoDecodeAccelerator::GetState() const { | 1460 DXVAVideoDecodeAccelerator::GetState() { |
1461 State state = kUninitialized; | 1461 State state = static_cast<State>( |
1462 ::InterlockedExchange(reinterpret_cast<long*>(&state), | 1462 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.
| |
1463 state_); | |
1464 return state; | 1463 return state; |
1465 } | 1464 } |
1466 | 1465 |
1467 void DXVAVideoDecodeAccelerator::SetState(State new_state) { | 1466 void DXVAVideoDecodeAccelerator::SetState(State new_state) { |
1468 if (!main_thread_task_runner_->BelongsToCurrentThread()) { | 1467 if (!main_thread_task_runner_->BelongsToCurrentThread()) { |
1469 main_thread_task_runner_->PostTask( | 1468 main_thread_task_runner_->PostTask( |
1470 FROM_HERE, | 1469 FROM_HERE, |
1471 base::Bind(&DXVAVideoDecodeAccelerator::SetState, | 1470 base::Bind(&DXVAVideoDecodeAccelerator::SetState, |
1472 weak_this_factory_.GetWeakPtr(), | 1471 weak_this_factory_.GetWeakPtr(), |
1473 new_state)); | 1472 new_state)); |
1474 return; | 1473 return; |
1475 } | 1474 } |
1476 ::InterlockedCompareExchange(reinterpret_cast<long*>(&state_), | 1475 ::InterlockedExchange(reinterpret_cast<volatile long*>(&state_), |
1477 new_state, | 1476 new_state); |
1478 state_); | |
1479 DCHECK_EQ(state_, new_state); | 1477 DCHECK_EQ(state_, new_state); |
1480 } | 1478 } |
1481 | 1479 |
1482 void DXVAVideoDecodeAccelerator::StartDecoderThread() { | 1480 void DXVAVideoDecodeAccelerator::StartDecoderThread() { |
1483 decoder_thread_.init_com_with_mta(false); | 1481 decoder_thread_.init_com_with_mta(false); |
1484 decoder_thread_.Start(); | 1482 decoder_thread_.Start(); |
1485 decoder_thread_task_runner_ = decoder_thread_.task_runner(); | 1483 decoder_thread_task_runner_ = decoder_thread_.task_runner(); |
1486 } | 1484 } |
1487 | 1485 |
1488 bool DXVAVideoDecodeAccelerator::OutputSamplesPresent() { | 1486 bool DXVAVideoDecodeAccelerator::OutputSamplesPresent() { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1613 FROM_HERE, | 1611 FROM_HERE, |
1614 base::Bind(&DXVAVideoDecodeAccelerator::CopySurfaceComplete, | 1612 base::Bind(&DXVAVideoDecodeAccelerator::CopySurfaceComplete, |
1615 weak_this_factory_.GetWeakPtr(), | 1613 weak_this_factory_.GetWeakPtr(), |
1616 src_surface, | 1614 src_surface, |
1617 dest_surface, | 1615 dest_surface, |
1618 picture_buffer_id, | 1616 picture_buffer_id, |
1619 input_buffer_id)); | 1617 input_buffer_id)); |
1620 } | 1618 } |
1621 | 1619 |
1622 } // namespace content | 1620 } // namespace content |
OLD | NEW |