| 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 static_assert(sizeof(State) == sizeof(long), "mismatched type sizes"); |
| 1462 ::InterlockedExchange(reinterpret_cast<long*>(&state), | 1462 State state = static_cast<State>( |
| 1463 state_); | 1463 InterlockedAdd(reinterpret_cast<volatile long*>(&state_), 0)); |
| 1464 return state; | 1464 return state; |
| 1465 } | 1465 } |
| 1466 | 1466 |
| 1467 void DXVAVideoDecodeAccelerator::SetState(State new_state) { | 1467 void DXVAVideoDecodeAccelerator::SetState(State new_state) { |
| 1468 if (!main_thread_task_runner_->BelongsToCurrentThread()) { | 1468 if (!main_thread_task_runner_->BelongsToCurrentThread()) { |
| 1469 main_thread_task_runner_->PostTask( | 1469 main_thread_task_runner_->PostTask( |
| 1470 FROM_HERE, | 1470 FROM_HERE, |
| 1471 base::Bind(&DXVAVideoDecodeAccelerator::SetState, | 1471 base::Bind(&DXVAVideoDecodeAccelerator::SetState, |
| 1472 weak_this_factory_.GetWeakPtr(), | 1472 weak_this_factory_.GetWeakPtr(), |
| 1473 new_state)); | 1473 new_state)); |
| 1474 return; | 1474 return; |
| 1475 } | 1475 } |
| 1476 ::InterlockedCompareExchange(reinterpret_cast<long*>(&state_), | 1476 |
| 1477 new_state, | 1477 static_assert(sizeof(State) == sizeof(long), "mismatched type sizes"); |
| 1478 state_); | 1478 ::InterlockedExchange(reinterpret_cast<volatile long*>(&state_), |
| 1479 new_state); |
| 1479 DCHECK_EQ(state_, new_state); | 1480 DCHECK_EQ(state_, new_state); |
| 1480 } | 1481 } |
| 1481 | 1482 |
| 1482 void DXVAVideoDecodeAccelerator::StartDecoderThread() { | 1483 void DXVAVideoDecodeAccelerator::StartDecoderThread() { |
| 1483 decoder_thread_.init_com_with_mta(false); | 1484 decoder_thread_.init_com_with_mta(false); |
| 1484 decoder_thread_.Start(); | 1485 decoder_thread_.Start(); |
| 1485 decoder_thread_task_runner_ = decoder_thread_.task_runner(); | 1486 decoder_thread_task_runner_ = decoder_thread_.task_runner(); |
| 1486 } | 1487 } |
| 1487 | 1488 |
| 1488 bool DXVAVideoDecodeAccelerator::OutputSamplesPresent() { | 1489 bool DXVAVideoDecodeAccelerator::OutputSamplesPresent() { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1613 FROM_HERE, | 1614 FROM_HERE, |
| 1614 base::Bind(&DXVAVideoDecodeAccelerator::CopySurfaceComplete, | 1615 base::Bind(&DXVAVideoDecodeAccelerator::CopySurfaceComplete, |
| 1615 weak_this_factory_.GetWeakPtr(), | 1616 weak_this_factory_.GetWeakPtr(), |
| 1616 src_surface, | 1617 src_surface, |
| 1617 dest_surface, | 1618 dest_surface, |
| 1618 picture_buffer_id, | 1619 picture_buffer_id, |
| 1619 input_buffer_id)); | 1620 input_buffer_id)); |
| 1620 } | 1621 } |
| 1621 | 1622 |
| 1622 } // namespace content | 1623 } // namespace content |
| OLD | NEW |