OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_decode_accelerator.h" | 5 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
350 copier_->Initialize(gl_decoder_.get()); | 350 copier_->Initialize(gl_decoder_.get()); |
351 } | 351 } |
352 | 352 |
353 // Here, we copy |surface_texture_id_| to the picture buffer instead of | 353 // Here, we copy |surface_texture_id_| to the picture buffer instead of |
354 // setting new texture to |surface_texture_| by calling attachToGLContext() | 354 // setting new texture to |surface_texture_| by calling attachToGLContext() |
355 // because: | 355 // because: |
356 // 1. Once we call detachFrameGLContext(), it deletes the texture previous | 356 // 1. Once we call detachFrameGLContext(), it deletes the texture previous |
357 // attached. | 357 // attached. |
358 // 2. SurfaceTexture requires us to apply a transform matrix when we show | 358 // 2. SurfaceTexture requires us to apply a transform matrix when we show |
359 // the texture. | 359 // the texture. |
360 copier_->DoCopyTexture(gl_decoder_.get(), GL_TEXTURE_EXTERNAL_OES, | 360 // TODO(hkuang): get the StreamTexture transform matrix in GPU process |
361 GL_TEXTURE_2D, surface_texture_id_, | 361 // instead of using default matrix crbug.com/226218. |
362 picture_buffer_texture_id, 0, size_.width(), | 362 const static GLfloat default_matrix[16] = {1.0f, 0.0f, 0.0f, 0.0f, |
363 size_.height(), false, false, false); | 363 0.0f, 1.0f, 0.0f, 0.0f, |
364 0.0f, 0.0f, 1.0f, 0.0f, | |
365 0.0f, 0.0f, 0.0f, 1.0f}; | |
366 copier_->DoCopyTextureWithTransform(gl_decoder_.get(), | |
dshwang
2014/07/10 22:08:22
I changed here like gles2_cmd_decoder. Could you r
| |
367 GL_TEXTURE_EXTERNAL_OES, | |
368 surface_texture_id_, | |
369 picture_buffer_texture_id, | |
370 0, | |
371 size_.width(), | |
372 size_.height(), | |
373 false, | |
374 false, | |
375 false, | |
376 default_matrix); | |
364 | 377 |
365 base::MessageLoop::current()->PostTask( | 378 base::MessageLoop::current()->PostTask( |
366 FROM_HERE, | 379 FROM_HERE, |
367 base::Bind(&AndroidVideoDecodeAccelerator::NotifyPictureReady, | 380 base::Bind(&AndroidVideoDecodeAccelerator::NotifyPictureReady, |
368 weak_this_factory_.GetWeakPtr(), | 381 weak_this_factory_.GetWeakPtr(), |
369 media::Picture(picture_buffer_id, bitstream_id))); | 382 media::Picture(picture_buffer_id, bitstream_id))); |
370 } | 383 } |
371 | 384 |
372 void AndroidVideoDecodeAccelerator::Decode( | 385 void AndroidVideoDecodeAccelerator::Decode( |
373 const media::BitstreamBuffer& bitstream_buffer) { | 386 const media::BitstreamBuffer& bitstream_buffer) { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
539 void AndroidVideoDecodeAccelerator::NotifyResetDone() { | 552 void AndroidVideoDecodeAccelerator::NotifyResetDone() { |
540 client_->NotifyResetDone(); | 553 client_->NotifyResetDone(); |
541 } | 554 } |
542 | 555 |
543 void AndroidVideoDecodeAccelerator::NotifyError( | 556 void AndroidVideoDecodeAccelerator::NotifyError( |
544 media::VideoDecodeAccelerator::Error error) { | 557 media::VideoDecodeAccelerator::Error error) { |
545 client_->NotifyError(error); | 558 client_->NotifyError(error); |
546 } | 559 } |
547 | 560 |
548 } // namespace content | 561 } // namespace content |
OLD | NEW |