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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 // pictures have been fed to saturate any internal buffering). This is | 57 // pictures have been fed to saturate any internal buffering). This is |
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( |
Ami GONE FROM CHROMIUM
2014/02/24 23:12:40
NULL-initialize client_.
(gonna stop making this c
sheu
2014/02/24 23:48:20
Done.
| |
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 : make_context_current_(make_context_current), |
72 make_context_current_(make_context_current), | |
73 codec_(media::kCodecH264), | 71 codec_(media::kCodecH264), |
74 state_(NO_ERROR), | 72 state_(NO_ERROR), |
75 surface_texture_id_(0), | 73 surface_texture_id_(0), |
76 picturebuffers_requested_(false), | 74 picturebuffers_requested_(false), |
77 gl_decoder_(decoder) { | 75 gl_decoder_(decoder) {} |
78 } | |
79 | 76 |
80 AndroidVideoDecodeAccelerator::~AndroidVideoDecodeAccelerator() { | 77 AndroidVideoDecodeAccelerator::~AndroidVideoDecodeAccelerator() { |
81 DCHECK(thread_checker_.CalledOnValidThread()); | 78 DCHECK(thread_checker_.CalledOnValidThread()); |
82 } | 79 } |
83 | 80 |
84 bool AndroidVideoDecodeAccelerator::Initialize( | 81 bool AndroidVideoDecodeAccelerator::Initialize( |
82 Client* client, | |
85 media::VideoCodecProfile profile) { | 83 media::VideoCodecProfile profile) { |
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 Loading... | |
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 |
OLD | NEW |