OLD | NEW |
---|---|
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 const scoped_refptr<VideoFrame>& frame, | 195 const scoped_refptr<VideoFrame>& frame, |
196 bool force_keyframe) { | 196 bool force_keyframe) { |
197 DVLOG(3) << __PRETTY_FUNCTION__ << ": " << force_keyframe; | 197 DVLOG(3) << __PRETTY_FUNCTION__ << ": " << force_keyframe; |
198 DCHECK(thread_checker_.CalledOnValidThread()); | 198 DCHECK(thread_checker_.CalledOnValidThread()); |
199 RETURN_ON_FAILURE(frame->format() == VideoFrame::I420, | 199 RETURN_ON_FAILURE(frame->format() == VideoFrame::I420, |
200 "Unexpected format", | 200 "Unexpected format", |
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( |
206 frame->stride(VideoFrame::kYPlane) && | 206 frame->row_bytes(VideoFrame::kYPlane) == |
207 frame->row_bytes(VideoFrame::kUPlane) == | 207 frame->stride(VideoFrame::kYPlane) && |
208 frame->stride(VideoFrame::kUPlane) && | 208 frame->row_bytes(VideoFrame::kUPlane) == |
209 frame->row_bytes(VideoFrame::kVPlane) == | 209 frame->stride(VideoFrame::kUPlane) && |
210 frame->stride(VideoFrame::kVPlane) && | 210 frame->row_bytes(VideoFrame::kVPlane) == |
211 gfx::Rect(frame->coded_size()) == frame->visible_rect(), | 211 frame->stride(VideoFrame::kVPlane) && |
212 "Non-packed frame, or visible rect != coded size", | 212 frame->coded_size().width() == frame->visible_rect().right(), |
Ami GONE FROM CHROMIUM
2014/02/27 01:20:12
this is a weaker check than before (e.g. a right-a
sheu
2014/02/28 00:40:19
My thought was that as long as the stride matched
| |
213 kInvalidArgumentError); | 213 "Non-packed frame, or visible_rect/coded_size mismatch", |
214 kInvalidArgumentError); | |
214 | 215 |
215 pending_frames_.push(MakeTuple(frame, force_keyframe, base::Time::Now())); | 216 pending_frames_.push(MakeTuple(frame, force_keyframe, base::Time::Now())); |
216 DoIOTask(); | 217 DoIOTask(); |
217 } | 218 } |
218 | 219 |
219 void AndroidVideoEncodeAccelerator::UseOutputBitstreamBuffer( | 220 void AndroidVideoEncodeAccelerator::UseOutputBitstreamBuffer( |
220 const media::BitstreamBuffer& buffer) { | 221 const media::BitstreamBuffer& buffer) { |
221 DVLOG(3) << __PRETTY_FUNCTION__ << ": bitstream_buffer_id=" << buffer.id(); | 222 DVLOG(3) << __PRETTY_FUNCTION__ << ": bitstream_buffer_id=" << buffer.id(); |
222 DCHECK(thread_checker_.CalledOnValidThread()); | 223 DCHECK(thread_checker_.CalledOnValidThread()); |
223 RETURN_ON_FAILURE(buffer.size() >= media_codec_->GetOutputBuffersCapacity(), | 224 RETURN_ON_FAILURE(buffer.size() >= media_codec_->GetOutputBuffersCapacity(), |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 base::MessageLoop::current()->PostTask( | 406 base::MessageLoop::current()->PostTask( |
406 FROM_HERE, | 407 FROM_HERE, |
407 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, | 408 base::Bind(&VideoEncodeAccelerator::Client::BitstreamBufferReady, |
408 client_ptr_factory_.GetWeakPtr(), | 409 client_ptr_factory_.GetWeakPtr(), |
409 bitstream_buffer.id(), | 410 bitstream_buffer.id(), |
410 size, | 411 size, |
411 key_frame)); | 412 key_frame)); |
412 } | 413 } |
413 | 414 |
414 } // namespace content | 415 } // namespace content |
OLD | NEW |