| 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 d0e98b74574ed586700308879a70194c797c578e..61ee4d778a1cf83419fa0b46364414ad8c25404e 100644
|
| --- a/content/common/gpu/media/dxva_video_decode_accelerator.cc
|
| +++ b/content/common/gpu/media/dxva_video_decode_accelerator.cc
|
| @@ -71,7 +71,7 @@ enum { kMaxIterationsForD3DFlush = 10 };
|
| static IMFSample* CreateEmptySample() {
|
| base::win::ScopedComPtr<IMFSample> sample;
|
| HRESULT hr = MFCreateSample(sample.Receive());
|
| - RETURN_ON_HR_FAILURE(hr, "MFCreateSample failed", NULL);
|
| + RETURN_ON_HR_FAILURE(hr, "MFCreateSample failed", nullptr);
|
| return sample.Detach();
|
| }
|
|
|
| @@ -94,10 +94,11 @@ static IMFSample* CreateEmptySampleWithBuffer(int buffer_length, int align) {
|
| align - 1,
|
| buffer.Receive());
|
| }
|
| - RETURN_ON_HR_FAILURE(hr, "Failed to create memory buffer for sample", NULL);
|
| + RETURN_ON_HR_FAILURE(hr, "Failed to create memory buffer for sample",
|
| + nullptr);
|
|
|
| hr = sample->AddBuffer(buffer);
|
| - RETURN_ON_HR_FAILURE(hr, "Failed to add buffer to sample", NULL);
|
| + RETURN_ON_HR_FAILURE(hr, "Failed to add buffer to sample", nullptr);
|
|
|
| return sample.Detach();
|
| }
|
| @@ -114,27 +115,27 @@ static IMFSample* CreateInputSample(const uint8* stream, int size,
|
| base::win::ScopedComPtr<IMFSample> sample;
|
| sample.Attach(CreateEmptySampleWithBuffer(std::max(min_size, size),
|
| alignment));
|
| - RETURN_ON_FAILURE(sample, "Failed to create empty sample", NULL);
|
| + RETURN_ON_FAILURE(sample, "Failed to create empty sample", nullptr);
|
|
|
| base::win::ScopedComPtr<IMFMediaBuffer> buffer;
|
| HRESULT hr = sample->GetBufferByIndex(0, buffer.Receive());
|
| - RETURN_ON_HR_FAILURE(hr, "Failed to get buffer from sample", NULL);
|
| + RETURN_ON_HR_FAILURE(hr, "Failed to get buffer from sample", nullptr);
|
|
|
| DWORD max_length = 0;
|
| DWORD current_length = 0;
|
| - uint8* destination = NULL;
|
| + uint8* destination = nullptr;
|
| hr = buffer->Lock(&destination, &max_length, ¤t_length);
|
| - RETURN_ON_HR_FAILURE(hr, "Failed to lock buffer", NULL);
|
| + RETURN_ON_HR_FAILURE(hr, "Failed to lock buffer", nullptr);
|
|
|
| CHECK_EQ(current_length, 0u);
|
| CHECK_GE(static_cast<int>(max_length), size);
|
| memcpy(destination, stream, size);
|
|
|
| hr = buffer->Unlock();
|
| - RETURN_ON_HR_FAILURE(hr, "Failed to unlock buffer", NULL);
|
| + RETURN_ON_HR_FAILURE(hr, "Failed to unlock buffer", nullptr);
|
|
|
| hr = buffer->SetCurrentLength(size);
|
| - RETURN_ON_HR_FAILURE(hr, "Failed to set buffer length", NULL);
|
| + RETURN_ON_HR_FAILURE(hr, "Failed to set buffer length", nullptr);
|
|
|
| return sample.Detach();
|
| }
|
| @@ -145,7 +146,7 @@ static IMFSample* CreateSampleFromInputBuffer(
|
| DWORD alignment) {
|
| base::SharedMemory shm(bitstream_buffer.handle(), true);
|
| RETURN_ON_FAILURE(shm.Map(bitstream_buffer.size()),
|
| - "Failed in base::SharedMemory::Map", NULL);
|
| + "Failed in base::SharedMemory::Map", nullptr);
|
|
|
| return CreateInputSample(reinterpret_cast<const uint8*>(shm.memory()),
|
| bitstream_buffer.size(),
|
| @@ -229,9 +230,9 @@ DXVAVideoDecodeAccelerator::DXVAPictureBuffer::Create(
|
| attrib_list);
|
| RETURN_ON_FAILURE(picture_buffer->decoding_surface_,
|
| "Failed to create surface",
|
| - linked_ptr<DXVAPictureBuffer>(NULL));
|
| + linked_ptr<DXVAPictureBuffer>(nullptr));
|
|
|
| - HANDLE share_handle = NULL;
|
| + HANDLE share_handle = nullptr;
|
| EGLBoolean ret = eglQuerySurfacePointerANGLE(
|
| egl_display,
|
| picture_buffer->decoding_surface_,
|
| @@ -240,7 +241,7 @@ DXVAVideoDecodeAccelerator::DXVAPictureBuffer::Create(
|
|
|
| RETURN_ON_FAILURE(share_handle && ret == EGL_TRUE,
|
| "Failed to query ANGLE surface pointer",
|
| - linked_ptr<DXVAPictureBuffer>(NULL));
|
| + linked_ptr<DXVAPictureBuffer>(nullptr));
|
|
|
| HRESULT hr = decoder.device_->CreateTexture(
|
| buffer.size().width(),
|
| @@ -253,7 +254,7 @@ DXVAVideoDecodeAccelerator::DXVAPictureBuffer::Create(
|
| &share_handle);
|
|
|
| RETURN_ON_HR_FAILURE(hr, "Failed to create texture",
|
| - linked_ptr<DXVAPictureBuffer>(NULL));
|
| + linked_ptr<DXVAPictureBuffer>(nullptr));
|
| picture_buffer->use_rgb_ = !!use_rgb;
|
| return picture_buffer;
|
| }
|
| @@ -262,7 +263,7 @@ DXVAVideoDecodeAccelerator::DXVAPictureBuffer::DXVAPictureBuffer(
|
| const media::PictureBuffer& buffer)
|
| : available_(true),
|
| picture_buffer_(buffer),
|
| - decoding_surface_(NULL),
|
| + decoding_surface_(nullptr),
|
| use_rgb_(true) {
|
| }
|
|
|
| @@ -278,7 +279,7 @@ DXVAVideoDecodeAccelerator::DXVAPictureBuffer::~DXVAPictureBuffer() {
|
| eglDestroySurface(
|
| egl_display,
|
| decoding_surface_);
|
| - decoding_surface_ = NULL;
|
| + decoding_surface_ = nullptr;
|
| }
|
| }
|
|
|
| @@ -330,7 +331,7 @@ bool DXVAVideoDecodeAccelerator::DXVAPictureBuffer::
|
| RETURN_ON_HR_FAILURE(hr, "Failed to get surface from texture", false);
|
|
|
| hr = decoder.device_->StretchRect(
|
| - dest_surface, NULL, d3d_surface, NULL, D3DTEXF_NONE);
|
| + dest_surface, nullptr, d3d_surface, nullptr, D3DTEXF_NONE);
|
| RETURN_ON_HR_FAILURE(hr, "Colorspace conversion via StretchRect failed",
|
| false);
|
|
|
| @@ -353,7 +354,7 @@ bool DXVAVideoDecodeAccelerator::DXVAPictureBuffer::
|
| // Workaround is to have an upper limit of 10 on the number of iterations to
|
| // wait for the Flush to finish.
|
| int iterations = 0;
|
| - while ((decoder.query_->GetData(NULL, 0, D3DGETDATA_FLUSH) == S_FALSE) &&
|
| + while ((decoder.query_->GetData(nullptr, 0, D3DGETDATA_FLUSH) == S_FALSE) &&
|
| ++iterations < kMaxIterationsForD3DFlush) {
|
| Sleep(1); // Poor-man's Yield().
|
| }
|
| @@ -402,7 +403,7 @@ bool DXVAVideoDecodeAccelerator::CreateD3DDevManager() {
|
| D3DCREATE_DISABLE_PSGP_THREADING |
|
| D3DCREATE_MULTITHREADED,
|
| &present_params,
|
| - NULL,
|
| + nullptr,
|
| device_.Receive());
|
| RETURN_ON_HR_FAILURE(hr, "Failed to create D3D device", false);
|
|
|
| @@ -424,9 +425,9 @@ bool DXVAVideoDecodeAccelerator::CreateD3DDevManager() {
|
|
|
| DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator(
|
| const base::Callback<bool(void)>& make_context_current)
|
| - : client_(NULL),
|
| + : client_(nullptr),
|
| dev_manager_reset_token_(0),
|
| - egl_config_(NULL),
|
| + egl_config_(nullptr),
|
| state_(kUninitialized),
|
| pictures_requested_(false),
|
| inputs_before_decode_(0),
|
| @@ -437,7 +438,7 @@ DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator(
|
| }
|
|
|
| DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() {
|
| - client_ = NULL;
|
| + client_ = nullptr;
|
| }
|
|
|
| bool DXVAVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile,
|
| @@ -679,7 +680,7 @@ bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) {
|
| reinterpret_cast<void**>(factory.Receive()));
|
| RETURN_ON_HR_FAILURE(hr, "DllGetClassObject for decoder failed", false);
|
|
|
| - hr = factory->CreateInstance(NULL,
|
| + hr = factory->CreateInstance(nullptr,
|
| __uuidof(IMFTransform),
|
| reinterpret_cast<void**>(decoder_.Receive()));
|
| RETURN_ON_HR_FAILURE(hr, "Failed to create decoder instance", false);
|
| @@ -835,7 +836,7 @@ void DXVAVideoDecodeAccelerator::DoDecode() {
|
| &output_data_buffer,
|
| &status);
|
| IMFCollection* events = output_data_buffer.pEvents;
|
| - if (events != NULL) {
|
| + if (events != nullptr) {
|
| VLOG(1) << "Got events from ProcessOuput, but discarding";
|
| events->Release();
|
| }
|
| @@ -875,7 +876,8 @@ void DXVAVideoDecodeAccelerator::DoDecode() {
|
| }
|
|
|
| bool DXVAVideoDecodeAccelerator::ProcessOutputSample(IMFSample* sample) {
|
| - RETURN_ON_FAILURE(sample, "Decode succeeded with NULL output sample", false);
|
| + RETURN_ON_FAILURE(sample, "Decode succeeded with nullptr output sample",
|
| + false);
|
|
|
| base::win::ScopedComPtr<IMFMediaBuffer> output_buffer;
|
| HRESULT hr = sample->GetBufferByIndex(0, output_buffer.Receive());
|
| @@ -997,7 +999,7 @@ void DXVAVideoDecodeAccelerator::StopOnError(
|
|
|
| if (client_)
|
| client_->NotifyError(error);
|
| - client_ = NULL;
|
| + client_ = nullptr;
|
|
|
| if (state_ != kUninitialized) {
|
| Invalidate();
|
|
|