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

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

Issue 23125014: Run VDA::Decode on GPU IO thread if VDA supports it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use a separate MessageFilter for GVDA Created 7 years, 3 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
OLDNEW
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 "content/common/gpu/gpu_channel.h" 10 #include "content/common/gpu/gpu_channel.h"
(...skipping 30 matching lines...) Expand all
41 enum { kMaxBitstreamsNotifiedInAdvance = 32 }; 41 enum { kMaxBitstreamsNotifiedInAdvance = 32 };
42 42
43 // static 43 // static
44 const base::TimeDelta AndroidVideoDecodeAccelerator::kDecodePollDelay = 44 const base::TimeDelta AndroidVideoDecodeAccelerator::kDecodePollDelay =
45 base::TimeDelta::FromMilliseconds(10); 45 base::TimeDelta::FromMilliseconds(10);
46 46
47 AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator( 47 AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator(
48 media::VideoDecodeAccelerator::Client* client, 48 media::VideoDecodeAccelerator::Client* client,
49 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, 49 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder,
50 const base::Callback<bool(void)>& make_context_current) 50 const base::Callback<bool(void)>& make_context_current)
51 : client_(client), 51 : child_message_loop_(base::MessageLoop::current()),
52 client_(client),
52 make_context_current_(make_context_current), 53 make_context_current_(make_context_current),
53 codec_(media::kCodecH264), 54 codec_(media::kCodecH264),
54 state_(NO_ERROR), 55 state_(NO_ERROR),
55 surface_texture_id_(0), 56 surface_texture_id_(0),
56 picturebuffers_requested_(false), 57 picturebuffers_requested_(false),
57 io_task_is_posted_(false), 58 io_task_is_posted_(false),
58 decoder_met_eos_(false), 59 decoder_met_eos_(false),
59 num_bytes_used_in_the_pending_buffer_(0), 60 num_bytes_used_in_the_pending_buffer_(0),
60 gl_decoder_(decoder) { 61 gl_decoder_(decoder) {
61 } 62 }
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 picture_buffer_texture_id, 0, size_.width(), 323 picture_buffer_texture_id, 0, size_.width(),
323 size_.height(), false, false, false); 324 size_.height(), false, false, false);
324 325
325 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( 326 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
326 &AndroidVideoDecodeAccelerator::NotifyPictureReady, 327 &AndroidVideoDecodeAccelerator::NotifyPictureReady,
327 base::AsWeakPtr(this), media::Picture(picture_buffer_id, bitstream_id))); 328 base::AsWeakPtr(this), media::Picture(picture_buffer_id, bitstream_id)));
328 } 329 }
329 330
330 void AndroidVideoDecodeAccelerator::Decode( 331 void AndroidVideoDecodeAccelerator::Decode(
331 const media::BitstreamBuffer& bitstream_buffer) { 332 const media::BitstreamBuffer& bitstream_buffer) {
333 if (!child_message_loop_->BelongsToCurrentThread) {
Ami GONE FROM CHROMIUM 2013/08/26 17:20:03 Can you add a TODO to make this safe from the IO t
piman 2013/08/27 04:01:20 You're missing the () to BelongsToCurrentThread().
wuchengli 2013/08/27 12:32:24 This part of change has been reverted.
wuchengli 2013/08/27 12:32:24 I added CanDecodeOnIOThread and this part of code
334 child_message_loop_->PostTask(
335 FROM_HERE,
336 base::Bind(&AndroidVideoDecodeAccelerator::Decode,
337 base::AsWeakPtr(this),
338 bitstream_buffer));
339 return;
340 }
341
332 DCHECK(thread_checker_.CalledOnValidThread()); 342 DCHECK(thread_checker_.CalledOnValidThread());
333 if (bitstream_buffer.id() != -1 && bitstream_buffer.size() == 0) { 343 if (bitstream_buffer.id() != -1 && bitstream_buffer.size() == 0) {
334 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( 344 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
335 &AndroidVideoDecodeAccelerator::NotifyEndOfBitstreamBuffer, 345 &AndroidVideoDecodeAccelerator::NotifyEndOfBitstreamBuffer,
336 base::AsWeakPtr(this), bitstream_buffer.id())); 346 base::AsWeakPtr(this), bitstream_buffer.id()));
337 return; 347 return;
338 } 348 }
339 349
340 pending_bitstream_buffers_.push(bitstream_buffer); 350 pending_bitstream_buffers_.push(bitstream_buffer);
341 351
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 void AndroidVideoDecodeAccelerator::NotifyResetDone() { 475 void AndroidVideoDecodeAccelerator::NotifyResetDone() {
466 client_->NotifyResetDone(); 476 client_->NotifyResetDone();
467 } 477 }
468 478
469 void AndroidVideoDecodeAccelerator::NotifyError( 479 void AndroidVideoDecodeAccelerator::NotifyError(
470 media::VideoDecodeAccelerator::Error error) { 480 media::VideoDecodeAccelerator::Error error) {
471 client_->NotifyError(error); 481 client_->NotifyError(error);
472 } 482 }
473 483
474 } // namespace content 484 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698