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

Side by Side Diff: content/renderer/pepper/video_decoder_shim.cc

Issue 864113002: Pepper: PPB_VideoDecoder software fallback should support all YUV formats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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
« no previous file with comments | « no previous file | media/filters/skcanvas_video_renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer/pepper/video_decoder_shim.h" 5 #include "content/renderer/pepper/video_decoder_shim.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <GLES2/gl2extchromium.h> 9 #include <GLES2/gl2extchromium.h>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/numerics/safe_conversions.h" 12 #include "base/numerics/safe_conversions.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "content/public/renderer/render_thread.h" 14 #include "content/public/renderer/render_thread.h"
15 #include "content/renderer/pepper/pepper_video_decoder_host.h" 15 #include "content/renderer/pepper/pepper_video_decoder_host.h"
16 #include "content/renderer/render_thread_impl.h" 16 #include "content/renderer/render_thread_impl.h"
17 #include "gpu/command_buffer/client/gles2_implementation.h" 17 #include "gpu/command_buffer/client/gles2_implementation.h"
18 #include "media/base/decoder_buffer.h" 18 #include "media/base/decoder_buffer.h"
19 #include "media/base/limits.h" 19 #include "media/base/limits.h"
20 #include "media/base/video_decoder.h" 20 #include "media/base/video_decoder.h"
21 #include "media/filters/ffmpeg_video_decoder.h" 21 #include "media/filters/ffmpeg_video_decoder.h"
22 #include "media/filters/skcanvas_video_renderer.h"
22 #include "media/filters/vpx_video_decoder.h" 23 #include "media/filters/vpx_video_decoder.h"
23 #include "media/video/picture.h" 24 #include "media/video/picture.h"
24 #include "media/video/video_decode_accelerator.h" 25 #include "media/video/video_decode_accelerator.h"
25 #include "ppapi/c/pp_errors.h" 26 #include "ppapi/c/pp_errors.h"
26 #include "third_party/libyuv/include/libyuv.h"
27 #include "webkit/common/gpu/context_provider_web_context.h" 27 #include "webkit/common/gpu/context_provider_web_context.h"
28 28
29 namespace content { 29 namespace content {
30 30
31 struct VideoDecoderShim::PendingDecode { 31 struct VideoDecoderShim::PendingDecode {
32 PendingDecode(uint32_t decode_id, 32 PendingDecode(uint32_t decode_id,
33 const scoped_refptr<media::DecoderBuffer>& buffer); 33 const scoped_refptr<media::DecoderBuffer>& buffer);
34 ~PendingDecode(); 34 ~PendingDecode();
35 35
36 const uint32_t decode_id; 36 const uint32_t decode_id;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 void VideoDecoderShim::DecoderImpl::OnOutputComplete( 264 void VideoDecoderShim::DecoderImpl::OnOutputComplete(
265 const scoped_refptr<media::VideoFrame>& frame) { 265 const scoped_refptr<media::VideoFrame>& frame) {
266 // Software decoders are expected to generated frames only when a Decode() 266 // Software decoders are expected to generated frames only when a Decode()
267 // call is pending. 267 // call is pending.
268 DCHECK(awaiting_decoder_); 268 DCHECK(awaiting_decoder_);
269 269
270 scoped_ptr<PendingFrame> pending_frame; 270 scoped_ptr<PendingFrame> pending_frame;
271 if (!frame->end_of_stream()) { 271 if (!frame->end_of_stream()) {
272 pending_frame.reset(new PendingFrame( 272 pending_frame.reset(new PendingFrame(
273 decode_id_, frame->coded_size(), frame->visible_rect())); 273 decode_id_, frame->coded_size(), frame->visible_rect()));
274 // Convert the VideoFrame pixels to ABGR to match VideoDecodeAccelerator. 274 // Convert the VideoFrame pixels to ABGR to match VideoDecodeAccelerator.
dshwang 2015/02/11 09:57:38 Hi, I have a question. In this code path, video fr
bbudge 2015/02/11 15:49:26 My understanding is that the software decoder retu
275 libyuv::I420ToABGR(frame->data(media::VideoFrame::kYPlane), 275 media::SkCanvasVideoRenderer::ConvertVideoFrameToRGBPixels(
276 frame->stride(media::VideoFrame::kYPlane), 276 frame,
277 frame->data(media::VideoFrame::kUPlane), 277 &pending_frame->argb_pixels.front(),
278 frame->stride(media::VideoFrame::kUPlane), 278 frame->coded_size().width() * 4);
279 frame->data(media::VideoFrame::kVPlane),
280 frame->stride(media::VideoFrame::kVPlane),
281 &pending_frame->argb_pixels.front(),
282 frame->coded_size().width() * 4,
283 frame->coded_size().width(),
284 frame->coded_size().height());
285 } else { 279 } else {
286 pending_frame.reset(new PendingFrame(decode_id_)); 280 pending_frame.reset(new PendingFrame(decode_id_));
287 } 281 }
288 282
289 main_message_loop_->PostTask(FROM_HERE, 283 main_message_loop_->PostTask(FROM_HERE,
290 base::Bind(&VideoDecoderShim::OnOutputComplete, 284 base::Bind(&VideoDecoderShim::OnOutputComplete,
291 shim_, 285 shim_,
292 base::Passed(&pending_frame))); 286 base::Passed(&pending_frame)));
293 } 287 }
294 288
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { 587 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) {
594 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); 588 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL();
595 gles2->DeleteTextures(1, &texture_id); 589 gles2->DeleteTextures(1, &texture_id);
596 } 590 }
597 591
598 void VideoDecoderShim::FlushCommandBuffer() { 592 void VideoDecoderShim::FlushCommandBuffer() {
599 context_provider_->ContextGL()->Flush(); 593 context_provider_->ContextGL()->Flush();
600 } 594 }
601 595
602 } // namespace content 596 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/filters/skcanvas_video_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698