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

Side by Side Diff: content/common/gpu/media/gpu_video_encode_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: Created 5 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_video_encode_accelerator.h" 5 #include "content/common/gpu/media/gpu_video_encode_accelerator.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 media::VideoFrame::WrapExternalSharedMemory( 269 media::VideoFrame::WrapExternalSharedMemory(
270 input_format_, 270 input_format_,
271 input_coded_size_, 271 input_coded_size_,
272 gfx::Rect(input_visible_size_), 272 gfx::Rect(input_visible_size_),
273 input_visible_size_, 273 input_visible_size_,
274 shm_memory, 274 shm_memory,
275 params.buffer_size, 275 params.buffer_size,
276 params.buffer_handle, 276 params.buffer_handle,
277 params.buffer_offset, 277 params.buffer_offset,
278 base::TimeDelta()); 278 base::TimeDelta());
279 if (!frame.get()) {
Pawel Osciak 2015/11/26 01:19:03 if (!frame) ?
emircan 2015/12/04 04:20:09 Done.
280 DLOG(ERROR) << "GpuVideoEncodeAccelerator::OnEncode(): could not create "
281 "VideoFrame for frame_id=" << params.frame_id;
Pawel Osciak 2015/11/26 01:19:03 s/"Video/<< "Video/
emircan 2015/12/04 04:20:09 Done.
282 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError);
283 return;
284 }
279 frame->AddDestructionObserver( 285 frame->AddDestructionObserver(
280 media::BindToCurrentLoop( 286 media::BindToCurrentLoop(
281 base::Bind(&GpuVideoEncodeAccelerator::EncodeFrameFinished, 287 base::Bind(&GpuVideoEncodeAccelerator::EncodeFrameFinished,
282 weak_this_factory_.GetWeakPtr(), 288 weak_this_factory_.GetWeakPtr(),
283 params.frame_id, 289 params.frame_id,
284 base::Passed(&shm)))); 290 base::Passed(&shm))));
285 291
286 if (!frame.get()) {
287 DLOG(ERROR) << "GpuVideoEncodeAccelerator::OnEncode(): could not create "
288 "VideoFrame for frame_id=" << params.frame_id;
289 NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError);
290 return;
291 }
292
293 encoder_->Encode(frame, params.force_keyframe); 292 encoder_->Encode(frame, params.force_keyframe);
294 } 293 }
295 294
296 void GpuVideoEncodeAccelerator::OnUseOutputBitstreamBuffer( 295 void GpuVideoEncodeAccelerator::OnUseOutputBitstreamBuffer(
297 int32 buffer_id, 296 int32 buffer_id,
298 base::SharedMemoryHandle buffer_handle, 297 base::SharedMemoryHandle buffer_handle,
299 uint32 buffer_size) { 298 uint32 buffer_size) {
300 DVLOG(3) << "GpuVideoEncodeAccelerator::OnUseOutputBitstreamBuffer(): " 299 DVLOG(3) << "GpuVideoEncodeAccelerator::OnUseOutputBitstreamBuffer(): "
301 "buffer_id=" << buffer_id 300 "buffer_id=" << buffer_id
302 << ", buffer_size=" << buffer_size; 301 << ", buffer_size=" << buffer_size;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 stub_->channel()->Send(message); 345 stub_->channel()->Send(message);
347 } 346 }
348 347
349 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message, 348 void GpuVideoEncodeAccelerator::SendCreateEncoderReply(IPC::Message* message,
350 bool succeeded) { 349 bool succeeded) {
351 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded); 350 GpuCommandBufferMsg_CreateVideoEncoder::WriteReplyParams(message, succeeded);
352 Send(message); 351 Send(message);
353 } 352 }
354 353
355 } // namespace content 354 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698