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

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

Issue 1476523005: Verify returned frames from media::VideoFrame::Wrap*() methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/gpu_jpeg_decode_accelerator.h" 5 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 media::VideoFrame::WrapExternalSharedMemory( 241 media::VideoFrame::WrapExternalSharedMemory(
242 media::PIXEL_FORMAT_I420, // format 242 media::PIXEL_FORMAT_I420, // format
243 params.coded_size, // coded_size 243 params.coded_size, // coded_size
244 gfx::Rect(params.coded_size), // visible_rect 244 gfx::Rect(params.coded_size), // visible_rect
245 params.coded_size, // natural_size 245 params.coded_size, // natural_size
246 shm_memory, // data 246 shm_memory, // data
247 params.output_buffer_size, // data_size 247 params.output_buffer_size, // data_size
248 params.output_video_frame_handle, // handle 248 params.output_video_frame_handle, // handle
249 0, // data_offset 249 0, // data_offset
250 base::TimeDelta()); // timestamp 250 base::TimeDelta()); // timestamp
251 frame->AddDestructionObserver(
252 base::Bind(DecodeFinished, base::Passed(&output_shm)));
253
254 if (!frame.get()) { 251 if (!frame.get()) {
255 LOG(ERROR) << "Could not create VideoFrame for input buffer id " 252 LOG(ERROR) << "Could not create VideoFrame for input buffer id "
256 << params.input_buffer_id; 253 << params.input_buffer_id;
257 NotifyDecodeStatusOnIOThread( 254 NotifyDecodeStatusOnIOThread(
258 *route_id, params.input_buffer_id, 255 *route_id, params.input_buffer_id,
259 media::JpegDecodeAccelerator::PLATFORM_FAILURE); 256 media::JpegDecodeAccelerator::PLATFORM_FAILURE);
260 base::SharedMemory::CloseHandle(params.input_buffer_handle); 257 base::SharedMemory::CloseHandle(params.input_buffer_handle);
261 return; 258 return;
262 } 259 }
260 frame->AddDestructionObserver(
261 base::Bind(DecodeFinished, base::Passed(&output_shm)));
mcasas 2016/01/12 17:46:16 nit: s/base::Passed/std::move/
emircan 2016/01/14 23:07:40 It causes a compile error as it is inside a base::
263 262
264 DCHECK_GT(client_map_.count(*route_id), 0u); 263 DCHECK_GT(client_map_.count(*route_id), 0u);
265 Client* client = client_map_[*route_id]; 264 Client* client = client_map_[*route_id];
266 client->Decode(input_buffer, frame); 265 client->Decode(input_buffer, frame);
267 } 266 }
268 267
269 protected: 268 protected:
270 ~MessageFilter() override { 269 ~MessageFilter() override {
271 if (client_map_.empty()) 270 if (client_map_.empty())
272 return; 271 return;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 for (const auto& create_jda_function : create_jda_fps) { 432 for (const auto& create_jda_function : create_jda_fps) {
434 scoped_ptr<media::JpegDecodeAccelerator> accelerator = 433 scoped_ptr<media::JpegDecodeAccelerator> accelerator =
435 (*create_jda_function)(base::ThreadTaskRunnerHandle::Get()); 434 (*create_jda_function)(base::ThreadTaskRunnerHandle::Get());
436 if (accelerator && accelerator->IsSupported()) 435 if (accelerator && accelerator->IsSupported())
437 return true; 436 return true;
438 } 437 }
439 return false; 438 return false;
440 } 439 }
441 440
442 } // namespace content 441 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698