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

Side by Side Diff: content/common/gpu/media/dxva_video_decode_accelerator_win.cc

Issue 1706023003: Moving the validation of bitstream_buffer into VDA implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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_win.h" 5 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 } 939 }
940 940
941 void DXVAVideoDecodeAccelerator::Decode( 941 void DXVAVideoDecodeAccelerator::Decode(
942 const media::BitstreamBuffer& bitstream_buffer) { 942 const media::BitstreamBuffer& bitstream_buffer) {
943 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); 943 DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
944 944
945 State state = GetState(); 945 State state = GetState();
946 RETURN_AND_NOTIFY_ON_FAILURE((state == kNormal || state == kStopped || 946 RETURN_AND_NOTIFY_ON_FAILURE((state == kNormal || state == kStopped ||
947 state == kFlushing), 947 state == kFlushing),
948 "Invalid state: " << state, ILLEGAL_STATE,); 948 "Invalid state: " << state, ILLEGAL_STATE,);
949 949
Pawel Osciak 2016/02/19 07:48:44 Perhaps we could just create SharedMemory here and
Owen Lin 2016/02/23 09:06:38 Done.
950 if (bitstream_buffer.id() < 0) {
951 if (base::SharedMemory::IsHandleValid(bitstream_buffer.handle()))
952 base::SharedMemory::CloseHandle(bitstream_buffer.handle());
953 RETURN_AND_NOTIFY_ON_FAILURE(
954 false, "Invalid bitstream_buffer, id: " << bitstream_buffer.id(),
955 INVALID_ARGUMENT, );
956 }
957
950 base::win::ScopedComPtr<IMFSample> sample; 958 base::win::ScopedComPtr<IMFSample> sample;
951 sample.Attach(CreateSampleFromInputBuffer(bitstream_buffer, 959 sample.Attach(CreateSampleFromInputBuffer(bitstream_buffer,
952 input_stream_info_.cbSize, 960 input_stream_info_.cbSize,
953 input_stream_info_.cbAlignment)); 961 input_stream_info_.cbAlignment));
954 RETURN_AND_NOTIFY_ON_FAILURE(sample.get(), "Failed to create input sample", 962 RETURN_AND_NOTIFY_ON_FAILURE(sample.get(), "Failed to create input sample",
955 PLATFORM_FAILURE, ); 963 PLATFORM_FAILURE, );
956 964
957 RETURN_AND_NOTIFY_ON_HR_FAILURE(sample->SetSampleTime(bitstream_buffer.id()), 965 RETURN_AND_NOTIFY_ON_HR_FAILURE(sample->SetSampleTime(bitstream_buffer.id()),
958 "Failed to associate input buffer id with sample", PLATFORM_FAILURE,); 966 "Failed to associate input buffer id with sample", PLATFORM_FAILURE,);
959 967
(...skipping 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 } 2389 }
2382 RETURN_ON_HR_FAILURE(hr, "Failed to set output type", false); 2390 RETURN_ON_HR_FAILURE(hr, "Failed to set output type", false);
2383 return true; 2391 return true;
2384 } 2392 }
2385 media_type.Release(); 2393 media_type.Release();
2386 } 2394 }
2387 return false; 2395 return false;
2388 } 2396 }
2389 2397
2390 } // namespace content 2398 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698