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

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

Issue 170843004: Pass Client pointer in Initialize() for VDA/VEA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 50e826de Rebase. Created 6 years, 10 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 (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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // speculative and it's unclear that this would be a win (nor that there's a 58 // speculative and it's unclear that this would be a win (nor that there's a
59 // reasonably device-agnostic way to fill in the "believes" above). 59 // reasonably device-agnostic way to fill in the "believes" above).
60 return base::TimeDelta::FromMilliseconds(10); 60 return base::TimeDelta::FromMilliseconds(10);
61 } 61 }
62 62
63 static inline const base::TimeDelta NoWaitTimeOut() { 63 static inline const base::TimeDelta NoWaitTimeOut() {
64 return base::TimeDelta::FromMicroseconds(0); 64 return base::TimeDelta::FromMicroseconds(0);
65 } 65 }
66 66
67 AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator( 67 AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator(
68 media::VideoDecodeAccelerator::Client* client,
69 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, 68 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder,
70 const base::Callback<bool(void)>& make_context_current) 69 const base::Callback<bool(void)>& make_context_current)
71 : client_(client), 70 : client_(NULL),
72 make_context_current_(make_context_current), 71 make_context_current_(make_context_current),
73 codec_(media::kCodecH264), 72 codec_(media::kCodecH264),
74 state_(NO_ERROR), 73 state_(NO_ERROR),
75 surface_texture_id_(0), 74 surface_texture_id_(0),
76 picturebuffers_requested_(false), 75 picturebuffers_requested_(false),
77 gl_decoder_(decoder) { 76 gl_decoder_(decoder) {}
78 }
79 77
80 AndroidVideoDecodeAccelerator::~AndroidVideoDecodeAccelerator() { 78 AndroidVideoDecodeAccelerator::~AndroidVideoDecodeAccelerator() {
81 DCHECK(thread_checker_.CalledOnValidThread()); 79 DCHECK(thread_checker_.CalledOnValidThread());
82 } 80 }
83 81
84 bool AndroidVideoDecodeAccelerator::Initialize( 82 bool AndroidVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile,
85 media::VideoCodecProfile profile) { 83 Client* client) {
86 DCHECK(!media_codec_); 84 DCHECK(!media_codec_);
87 DCHECK(thread_checker_.CalledOnValidThread()); 85 DCHECK(thread_checker_.CalledOnValidThread());
88 86
87 client_ = client;
88
89 if (!media::MediaCodecBridge::IsAvailable()) 89 if (!media::MediaCodecBridge::IsAvailable())
90 return false; 90 return false;
91 91
92 if (profile == media::VP8PROFILE_MAIN) { 92 if (profile == media::VP8PROFILE_MAIN) {
93 codec_ = media::kCodecVP8; 93 codec_ = media::kCodecVP8;
94 } else { 94 } else {
95 // TODO(dwkang): enable H264 once b/8125974 is fixed. 95 // TODO(dwkang): enable H264 once b/8125974 is fixed.
96 LOG(ERROR) << "Unsupported profile: " << profile; 96 LOG(ERROR) << "Unsupported profile: " << profile;
97 return false; 97 return false;
98 } 98 }
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 void AndroidVideoDecodeAccelerator::NotifyResetDone() { 525 void AndroidVideoDecodeAccelerator::NotifyResetDone() {
526 client_->NotifyResetDone(); 526 client_->NotifyResetDone();
527 } 527 }
528 528
529 void AndroidVideoDecodeAccelerator::NotifyError( 529 void AndroidVideoDecodeAccelerator::NotifyError(
530 media::VideoDecodeAccelerator::Error error) { 530 media::VideoDecodeAccelerator::Error error) {
531 client_->NotifyError(error); 531 client_->NotifyError(error);
532 } 532 }
533 533
534 } // namespace content 534 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698