aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPin-chih Lin <johnylin@google.com>2018-05-08 22:05:32 +0800
committerPin-chih Lin <johnylin@google.com>2018-05-16 21:16:55 +0800
commit32119df22ad6e8f3faf78c1ceadeafb657098795 (patch)
tree960070edb564c9f4695a42dc5ba107d634a11584
parentfec9858bc46a83fc361574cb71bf3bfa240321aa (diff)
downloadv4l2_codec2-32119df22ad6e8f3faf78c1ceadeafb657098795.tar.gz
codec2: fix build by assigning absolute namespace path ::base
ag/4009937 produces compile error after C2VDAComponent includes "v4l2/C2VDABQBlockPool.h", there is "namespace android::base" which misleads compiler to find the correct "namespace base" in libchrome. To solve this, change to use absolute namespace "::base". Bug: 79239042 Test: build image Change-Id: I74658afa1797d5a48dbb1844628a57f3f533c25e
-rw-r--r--C2VDAComponent.cpp76
1 files changed, 40 insertions, 36 deletions
diff --git a/C2VDAComponent.cpp b/C2VDAComponent.cpp
index 01ade40..305879b 100644
--- a/C2VDAComponent.cpp
+++ b/C2VDAComponent.cpp
@@ -197,7 +197,7 @@ C2VDAComponent::~C2VDAComponent() {
if (mThread.IsRunning()) {
mTaskRunner->PostTask(FROM_HERE,
- base::Bind(&C2VDAComponent::onDestroy, base::Unretained(this)));
+ ::base::Bind(&C2VDAComponent::onDestroy, ::base::Unretained(this)));
mThread.Stop();
}
}
@@ -212,7 +212,7 @@ void C2VDAComponent::onDestroy() {
stopDequeueThread();
}
-void C2VDAComponent::onStart(media::VideoCodecProfile profile, base::WaitableEvent* done) {
+void C2VDAComponent::onStart(media::VideoCodecProfile profile, ::base::WaitableEvent* done) {
DCHECK(mTaskRunner->BelongsToCurrentThread());
ALOGV("onStart");
CHECK_EQ(mComponentState, ComponentState::UNINITIALIZED);
@@ -249,7 +249,7 @@ void C2VDAComponent::onQueueWork(std::unique_ptr<C2Work> work) {
// TODO(johnylin): set a maximum size of mQueue and check if mQueue is already full.
mTaskRunner->PostTask(FROM_HERE,
- base::Bind(&C2VDAComponent::onDequeueWork, base::Unretained(this)));
+ ::base::Bind(&C2VDAComponent::onDequeueWork, ::base::Unretained(this)));
}
void C2VDAComponent::onDequeueWork() {
@@ -298,8 +298,8 @@ void C2VDAComponent::onDequeueWork() {
mPendingWorks.emplace_back(std::move(work));
if (!mQueue.empty()) {
- mTaskRunner->PostTask(FROM_HERE,
- base::Bind(&C2VDAComponent::onDequeueWork, base::Unretained(this)));
+ mTaskRunner->PostTask(FROM_HERE, ::base::Bind(&C2VDAComponent::onDequeueWork,
+ ::base::Unretained(this)));
}
}
@@ -374,7 +374,7 @@ void C2VDAComponent::onOutputBufferDone(int32_t pictureBufferId, int32_t bitstre
C2Fence())));
// TODO: this does not work for timestamps as they can wrap around
- int64_t currentTimestamp = base::checked_cast<int64_t>(work->input.ordinal.timestamp.peek());
+ int64_t currentTimestamp = ::base::checked_cast<int64_t>(work->input.ordinal.timestamp.peek());
CHECK_GE(currentTimestamp, mLastOutputTimestamp);
mLastOutputTimestamp = currentTimestamp;
@@ -434,7 +434,7 @@ void C2VDAComponent::onDrainDone() {
// Work dequeueing was stopped while component draining. Restart it.
mTaskRunner->PostTask(FROM_HERE,
- base::Bind(&C2VDAComponent::onDequeueWork, base::Unretained(this)));
+ ::base::Bind(&C2VDAComponent::onDequeueWork, ::base::Unretained(this)));
}
void C2VDAComponent::onFlush() {
@@ -454,7 +454,7 @@ void C2VDAComponent::onFlush() {
mComponentState = ComponentState::FLUSHING;
}
-void C2VDAComponent::onStop(base::WaitableEvent* done) {
+void C2VDAComponent::onStop(::base::WaitableEvent* done) {
DCHECK(mTaskRunner->BelongsToCurrentThread());
ALOGV("onStop");
EXPECT_RUNNING_OR_RETURN_ON_ERROR();
@@ -755,7 +755,7 @@ void C2VDAComponent::appendOutputBuffer(std::shared_ptr<C2GraphicBlock> block) {
#endif
ALOGV("HAL pixel format: 0x%x", static_cast<uint32_t>(info.mPixelFormat));
- base::ScopedFD passedHandle(dup(info.mGraphicBlock->handle()->data[0]));
+ ::base::ScopedFD passedHandle(dup(info.mGraphicBlock->handle()->data[0]));
if (!passedHandle.is_valid()) {
ALOGE("Failed to dup(%d), errno=%d", info.mGraphicBlock->handle()->data[0], errno);
reportError(C2_CORRUPTED);
@@ -813,8 +813,8 @@ c2_status_t C2VDAComponent::queue_nb(std::list<std::unique_ptr<C2Work>>* const i
}
while (!items->empty()) {
mTaskRunner->PostTask(FROM_HERE,
- base::Bind(&C2VDAComponent::onQueueWork, base::Unretained(this),
- base::Passed(&items->front())));
+ ::base::Bind(&C2VDAComponent::onQueueWork, ::base::Unretained(this),
+ ::base::Passed(&items->front())));
items->pop_front();
}
return C2_OK;
@@ -833,7 +833,8 @@ c2_status_t C2VDAComponent::flush_sm(flush_mode_t mode,
if (mState.load() != State::RUNNING) {
return C2_BAD_STATE;
}
- mTaskRunner->PostTask(FROM_HERE, base::Bind(&C2VDAComponent::onFlush, base::Unretained(this)));
+ mTaskRunner->PostTask(FROM_HERE, ::base::Bind(&C2VDAComponent::onFlush,
+ ::base::Unretained(this)));
// Instead of |flushedWork|, abandoned works will be returned via onWorkDone_nb() callback.
return C2_OK;
}
@@ -845,8 +846,9 @@ c2_status_t C2VDAComponent::drain_nb(drain_mode_t mode) {
if (mState.load() != State::RUNNING) {
return C2_BAD_STATE;
}
- mTaskRunner->PostTask(FROM_HERE, base::Bind(&C2VDAComponent::onDrain, base::Unretained(this),
- static_cast<uint32_t>(mode)));
+ mTaskRunner->PostTask(FROM_HERE,
+ ::base::Bind(&C2VDAComponent::onDrain, ::base::Unretained(this),
+ static_cast<uint32_t>(mode)));
return C2_OK;
}
@@ -861,10 +863,11 @@ c2_status_t C2VDAComponent::start() {
mCodecProfile = mIntfImpl->getCodecProfile();
ALOGI("get parameter: mCodecProfile = %d", static_cast<int>(mCodecProfile));
- base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC,
- base::WaitableEvent::InitialState::NOT_SIGNALED);
- mTaskRunner->PostTask(FROM_HERE, base::Bind(&C2VDAComponent::onStart, base::Unretained(this),
- mCodecProfile, &done));
+ ::base::WaitableEvent done(::base::WaitableEvent::ResetPolicy::AUTOMATIC,
+ ::base::WaitableEvent::InitialState::NOT_SIGNALED);
+ mTaskRunner->PostTask(FROM_HERE,
+ ::base::Bind(&C2VDAComponent::onStart, ::base::Unretained(this),
+ mCodecProfile, &done));
done.Wait();
if (mVDAInitResult != VideoDecodeAcceleratorAdaptor::Result::SUCCESS) {
ALOGE("Failed to start component due to VDA error: %d", static_cast<int>(mVDAInitResult));
@@ -883,10 +886,10 @@ c2_status_t C2VDAComponent::stop() {
return C2_OK; // Component is already in stopped state.
}
- base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC,
- base::WaitableEvent::InitialState::NOT_SIGNALED);
+ ::base::WaitableEvent done(::base::WaitableEvent::ResetPolicy::AUTOMATIC,
+ ::base::WaitableEvent::InitialState::NOT_SIGNALED);
mTaskRunner->PostTask(FROM_HERE,
- base::Bind(&C2VDAComponent::onStop, base::Unretained(this), &done));
+ ::base::Bind(&C2VDAComponent::onStop, ::base::Unretained(this), &done));
done.Wait();
mState.store(State::LOADED);
return C2_OK;
@@ -915,8 +918,9 @@ void C2VDAComponent::providePictureBuffers(uint32_t minNumBuffers, const media::
// Set mRequestedVisibleRect to default.
mRequestedVisibleRect = media::Rect();
- mTaskRunner->PostTask(FROM_HERE, base::Bind(&C2VDAComponent::onOutputFormatChanged,
- base::Unretained(this), base::Passed(&format)));
+ mTaskRunner->PostTask(FROM_HERE, ::base::Bind(&C2VDAComponent::onOutputFormatChanged,
+ ::base::Unretained(this),
+ ::base::Passed(&format)));
}
void C2VDAComponent::dismissPictureBuffer(int32_t pictureBufferId) {
@@ -931,28 +935,28 @@ void C2VDAComponent::pictureReady(int32_t pictureBufferId, int32_t bitstreamId,
if (mRequestedVisibleRect != cropRect) {
mRequestedVisibleRect = cropRect;
- mTaskRunner->PostTask(FROM_HERE, base::Bind(&C2VDAComponent::onVisibleRectChanged,
- base::Unretained(this), cropRect));
+ mTaskRunner->PostTask(FROM_HERE, ::base::Bind(&C2VDAComponent::onVisibleRectChanged,
+ ::base::Unretained(this), cropRect));
}
- mTaskRunner->PostTask(FROM_HERE,
- base::Bind(&C2VDAComponent::onOutputBufferDone, base::Unretained(this),
- pictureBufferId, bitstreamId));
+ mTaskRunner->PostTask(FROM_HERE, ::base::Bind(&C2VDAComponent::onOutputBufferDone,
+ ::base::Unretained(this),
+ pictureBufferId, bitstreamId));
}
void C2VDAComponent::notifyEndOfBitstreamBuffer(int32_t bitstreamId) {
- mTaskRunner->PostTask(FROM_HERE, base::Bind(&C2VDAComponent::onInputBufferDone,
- base::Unretained(this), bitstreamId));
+ mTaskRunner->PostTask(FROM_HERE, ::base::Bind(&C2VDAComponent::onInputBufferDone,
+ ::base::Unretained(this), bitstreamId));
}
void C2VDAComponent::notifyFlushDone() {
mTaskRunner->PostTask(FROM_HERE,
- base::Bind(&C2VDAComponent::onDrainDone, base::Unretained(this)));
+ ::base::Bind(&C2VDAComponent::onDrainDone, ::base::Unretained(this)));
}
void C2VDAComponent::notifyResetDone() {
mTaskRunner->PostTask(FROM_HERE,
- base::Bind(&C2VDAComponent::onResetDone, base::Unretained(this)));
+ ::base::Bind(&C2VDAComponent::onResetDone, ::base::Unretained(this)));
}
void C2VDAComponent::notifyError(VideoDecodeAcceleratorAdaptor::Result error) {
@@ -1084,8 +1088,8 @@ bool C2VDAComponent::startDequeueThread(const media::Size& size, uint32_t pixelF
mDequeueLoopStop.store(false);
mBuffersInClient.store(0u);
mDequeueThread.task_runner()->PostTask(
- FROM_HERE, base::Bind(&C2VDAComponent::dequeueThreadLoop, base::Unretained(this),
- size, pixelFormat));
+ FROM_HERE, ::base::Bind(&C2VDAComponent::dequeueThreadLoop, ::base::Unretained(this),
+ size, pixelFormat));
return true;
}
@@ -1114,8 +1118,8 @@ void C2VDAComponent::dequeueThreadLoop(const media::Size& size, uint32_t pixelFo
}
if (err == C2_OK) {
auto slot = getSlotFromGraphicBlockHandle(block->handle());
- mTaskRunner->PostTask(FROM_HERE, base::Bind(&C2VDAComponent::onOutputBufferReturned,
- base::Unretained(this), slot));
+ mTaskRunner->PostTask(FROM_HERE, ::base::Bind(&C2VDAComponent::onOutputBufferReturned,
+ ::base::Unretained(this), slot));
mBuffersInClient--;
} else {
ALOGE("dequeueThreadLoop got error: %d", err);