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

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

Issue 178133005: Audit/fix use of media::VideoFrame::coded_size() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 2121885f Rebase. Created 6 years, 9 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 | Annotate | Revision Log
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/android_video_encode_accelerator.h" 5 #include "content/common/gpu/media/android_video_encode_accelerator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.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/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 kInvalidArgumentError); 201 kInvalidArgumentError);
202 202
203 // MediaCodec doesn't have a way to specify stride for non-Packed formats, so 203 // MediaCodec doesn't have a way to specify stride for non-Packed formats, so
204 // we insist on being called with packed frames and no cropping :( 204 // we insist on being called with packed frames and no cropping :(
205 RETURN_ON_FAILURE(frame->row_bytes(VideoFrame::kYPlane) == 205 RETURN_ON_FAILURE(frame->row_bytes(VideoFrame::kYPlane) ==
206 frame->stride(VideoFrame::kYPlane) && 206 frame->stride(VideoFrame::kYPlane) &&
207 frame->row_bytes(VideoFrame::kUPlane) == 207 frame->row_bytes(VideoFrame::kUPlane) ==
208 frame->stride(VideoFrame::kUPlane) && 208 frame->stride(VideoFrame::kUPlane) &&
209 frame->row_bytes(VideoFrame::kVPlane) == 209 frame->row_bytes(VideoFrame::kVPlane) ==
210 frame->stride(VideoFrame::kVPlane) && 210 frame->stride(VideoFrame::kVPlane) &&
211 gfx::Rect(frame->coded_size()) == frame->visible_rect(), 211 frame->coded_size() == frame->visible_rect().size(),
212 "Non-packed frame, or visible rect != coded size", 212 "Non-packed frame, or visible_rect != coded_size",
213 kInvalidArgumentError); 213 kInvalidArgumentError);
214 214
215 pending_frames_.push(MakeTuple(frame, force_keyframe, base::Time::Now())); 215 pending_frames_.push(MakeTuple(frame, force_keyframe, base::Time::Now()));
216 DoIOTask(); 216 DoIOTask();
217 } 217 }
218 218
219 void AndroidVideoEncodeAccelerator::UseOutputBitstreamBuffer( 219 void AndroidVideoEncodeAccelerator::UseOutputBitstreamBuffer(
220 const media::BitstreamBuffer& buffer) { 220 const media::BitstreamBuffer& buffer) {
221 DVLOG(3) << __PRETTY_FUNCTION__ << ": bitstream_buffer_id=" << buffer.id(); 221 DVLOG(3) << __PRETTY_FUNCTION__ << ": bitstream_buffer_id=" << buffer.id();
222 DCHECK(thread_checker_.CalledOnValidThread()); 222 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 base::MessageLoop::current()->PostTask( 405 base::MessageLoop::current()->PostTask(
406 FROM_HERE, 406 FROM_HERE,
407 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, 407 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady,
408 client_ptr_factory_->GetWeakPtr(), 408 client_ptr_factory_->GetWeakPtr(),
409 bitstream_buffer.id(), 409 bitstream_buffer.id(),
410 size, 410 size,
411 key_frame)); 411 key_frame));
412 } 412 }
413 413
414 } // namespace content 414 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698