Skip to content
Snippets Groups Projects
Commit aa357b36 authored by Prameet Shah's avatar Prameet Shah
Browse files

Explicitly specify ::base

The original change ag/25539865 was submitted in `main`. Backporting it
to this branch to reduce divergence.

Bug: 314693926
Bug: 314784915
Test: m
Change-Id: I25a226b8eb962138489f30cd0fa1a42c3e599bdf
parent b4ac6f10
No related branches found
No related tags found
No related merge requests found
...@@ -26,11 +26,11 @@ public: ...@@ -26,11 +26,11 @@ public:
}; };
static const char* DecodeStatusToString(DecodeStatus status); static const char* DecodeStatusToString(DecodeStatus status);
using GetPoolCB = base::RepeatingCallback<std::unique_ptr<VideoFramePool>( using GetPoolCB = ::base::RepeatingCallback<std::unique_ptr<VideoFramePool>(
const ui::Size& size, HalPixelFormat pixelFormat, size_t numOutputBuffers)>; const ui::Size& size, HalPixelFormat pixelFormat, size_t numOutputBuffers)>;
using DecodeCB = base::OnceCallback<void(DecodeStatus)>; using DecodeCB = ::base::OnceCallback<void(DecodeStatus)>;
using OutputCB = base::RepeatingCallback<void(std::unique_ptr<VideoFrame>)>; using OutputCB = ::base::RepeatingCallback<void(std::unique_ptr<VideoFrame>)>;
using ErrorCB = base::RepeatingCallback<void()>; using ErrorCB = ::base::RepeatingCallback<void()>;
virtual ~VideoDecoder(); virtual ~VideoDecoder();
......
...@@ -55,13 +55,13 @@ public: ...@@ -55,13 +55,13 @@ public:
}; };
using FetchOutputBufferCB = using FetchOutputBufferCB =
base::RepeatingCallback<void(uint32_t, std::unique_ptr<BitstreamBuffer>* buffer)>; ::base::RepeatingCallback<void(uint32_t, std::unique_ptr<BitstreamBuffer>* buffer)>;
// TODO(dstaessens): Change callbacks to OnceCallback provided when requesting encode/drain. // TODO(dstaessens): Change callbacks to OnceCallback provided when requesting encode/drain.
using InputBufferDoneCB = base::RepeatingCallback<void(uint64_t)>; using InputBufferDoneCB = ::base::RepeatingCallback<void(uint64_t)>;
using OutputBufferDoneCB = base::RepeatingCallback<void( using OutputBufferDoneCB = ::base::RepeatingCallback<void(
size_t, int64_t, bool, std::unique_ptr<BitstreamBuffer> buffer)>; size_t, int64_t, bool, std::unique_ptr<BitstreamBuffer> buffer)>;
using DrainDoneCB = base::RepeatingCallback<void(bool)>; using DrainDoneCB = ::base::RepeatingCallback<void(bool)>;
using ErrorCB = base::RepeatingCallback<void()>; using ErrorCB = ::base::RepeatingCallback<void()>;
virtual ~VideoEncoder() = default; virtual ~VideoEncoder() = default;
......
...@@ -128,7 +128,7 @@ private: ...@@ -128,7 +128,7 @@ private:
// Do the actual queue operation once the v4l2_buffer structure is properly filled. // Do the actual queue operation once the v4l2_buffer structure is properly filled.
bool doQueue() &&; bool doQueue() &&;
V4L2WritableBufferRef(const struct v4l2_buffer& v4l2Buffer, base::WeakPtr<V4L2Queue> queue); V4L2WritableBufferRef(const struct v4l2_buffer& v4l2Buffer, ::base::WeakPtr<V4L2Queue> queue);
V4L2WritableBufferRef(const V4L2WritableBufferRef&) = delete; V4L2WritableBufferRef(const V4L2WritableBufferRef&) = delete;
V4L2WritableBufferRef& operator=(const V4L2WritableBufferRef&) = delete; V4L2WritableBufferRef& operator=(const V4L2WritableBufferRef&) = delete;
...@@ -147,7 +147,7 @@ private: ...@@ -147,7 +147,7 @@ private:
// buffers they originate from. This flexibility is required because V4L2ReadableBufferRefs can be // buffers they originate from. This flexibility is required because V4L2ReadableBufferRefs can be
// embedded into VideoFrames, which are then passed to other threads and not necessarily destroyed // embedded into VideoFrames, which are then passed to other threads and not necessarily destroyed
// before the V4L2Queue buffers are freed. // before the V4L2Queue buffers are freed.
class V4L2ReadableBuffer : public base::RefCountedThreadSafe<V4L2ReadableBuffer> { class V4L2ReadableBuffer : public ::base::RefCountedThreadSafe<V4L2ReadableBuffer> {
public: public:
// Returns whether the V4L2_BUF_FLAG_LAST flag is set for this buffer. // Returns whether the V4L2_BUF_FLAG_LAST flag is set for this buffer.
bool isLast() const; bool isLast() const;
...@@ -171,11 +171,11 @@ public: ...@@ -171,11 +171,11 @@ public:
private: private:
friend class V4L2BufferRefFactory; friend class V4L2BufferRefFactory;
friend class base::RefCountedThreadSafe<V4L2ReadableBuffer>; friend class ::base::RefCountedThreadSafe<V4L2ReadableBuffer>;
~V4L2ReadableBuffer(); ~V4L2ReadableBuffer();
V4L2ReadableBuffer(const struct v4l2_buffer& v4l2Buffer, base::WeakPtr<V4L2Queue> queue); V4L2ReadableBuffer(const struct v4l2_buffer& v4l2Buffer, ::base::WeakPtr<V4L2Queue> queue);
V4L2ReadableBuffer(const V4L2ReadableBuffer&) = delete; V4L2ReadableBuffer(const V4L2ReadableBuffer&) = delete;
V4L2ReadableBuffer& operator=(const V4L2ReadableBuffer&) = delete; V4L2ReadableBuffer& operator=(const V4L2ReadableBuffer&) = delete;
...@@ -206,7 +206,7 @@ class V4L2Buffer; ...@@ -206,7 +206,7 @@ class V4L2Buffer;
// metadata, as well as making other references to it. The buffer will not be reused until all // metadata, as well as making other references to it. The buffer will not be reused until all
// the references are dropped. Once this happens, the buffer goes back to the free list described // the references are dropped. Once this happens, the buffer goes back to the free list described
// in 1). // in 1).
class V4L2Queue : public base::RefCountedThreadSafe<V4L2Queue> { class V4L2Queue : public ::base::RefCountedThreadSafe<V4L2Queue> {
public: public:
// Set |fourcc| as the current format on this queue. |size| corresponds to the desired buffer's // Set |fourcc| as the current format on this queue. |size| corresponds to the desired buffer's
// dimensions (i.e. width and height members of v4l2_pix_format_mplane (if not applicable, pass // dimensions (i.e. width and height members of v4l2_pix_format_mplane (if not applicable, pass
...@@ -229,10 +229,10 @@ public: ...@@ -229,10 +229,10 @@ public:
size_t bufferSize) WARN_UNUSED_RESULT; size_t bufferSize) WARN_UNUSED_RESULT;
// Returns the currently set format on the queue. The result is returned as a std::pair where // Returns the currently set format on the queue. The result is returned as a std::pair where
// the first member is the format, or base::nullopt if the format could not be obtained due to // the first member is the format, or ::base::nullopt if the format could not be obtained due
// an ioctl error. The second member is only used in case of an error and contains the |errno| // to an ioctl error. The second member is only used in case of an error and contains the
// set by the failing ioctl. If the first member is not base::nullopt, the second member will // |errno| set by the failing ioctl. If the first member is not ::base::nullopt, the second
// always be zero. // member will always be zero.
// //
// If the second member is 0, then the first member is guaranteed to have a valid value. So // If the second member is 0, then the first member is guaranteed to have a valid value. So
// clients that are not interested in the precise error message can just check that the first // clients that are not interested in the precise error message can just check that the first
...@@ -329,19 +329,20 @@ private: ...@@ -329,19 +329,20 @@ private:
scoped_refptr<V4L2Device> mDevice; scoped_refptr<V4L2Device> mDevice;
// Callback to call in this queue's destructor. // Callback to call in this queue's destructor.
base::OnceClosure mDestroyCb; ::base::OnceClosure mDestroyCb;
V4L2Queue(scoped_refptr<V4L2Device> dev, enum v4l2_buf_type type, base::OnceClosure destroyCb); V4L2Queue(scoped_refptr<V4L2Device> dev, enum v4l2_buf_type type,
::base::OnceClosure destroyCb);
friend class V4L2QueueFactory; friend class V4L2QueueFactory;
friend class V4L2BufferRefBase; friend class V4L2BufferRefBase;
friend class base::RefCountedThreadSafe<V4L2Queue>; friend class ::base::RefCountedThreadSafe<V4L2Queue>;
SEQUENCE_CHECKER(mSequenceChecker); SEQUENCE_CHECKER(mSequenceChecker);
base::WeakPtrFactory<V4L2Queue> mWeakThisFactory{this}; ::base::WeakPtrFactory<V4L2Queue> mWeakThisFactory{this};
}; };
class V4L2Device : public base::RefCountedThreadSafe<V4L2Device> { class V4L2Device : public ::base::RefCountedThreadSafe<V4L2Device> {
public: public:
// Utility format conversion functions // Utility format conversion functions
// If there is no corresponding single- or multi-planar format, returns 0. // If there is no corresponding single- or multi-planar format, returns 0.
...@@ -375,7 +376,7 @@ public: ...@@ -375,7 +376,7 @@ public:
// Composes human readable string of v4l2_buffer. // Composes human readable string of v4l2_buffer.
static std::string v4L2BufferToString(const struct v4l2_buffer& buffer); static std::string v4L2BufferToString(const struct v4l2_buffer& buffer);
// Composes VideoFrameLayout based on v4l2_format. If error occurs, it returns base::nullopt. // Composes VideoFrameLayout based on v4l2_format. If error occurs, it returns ::base::nullopt.
static std::optional<VideoFrameLayout> v4L2FormatToVideoFrameLayout( static std::optional<VideoFrameLayout> v4L2FormatToVideoFrameLayout(
const struct v4l2_format& format); const struct v4l2_format& format);
...@@ -442,8 +443,8 @@ public: ...@@ -442,8 +443,8 @@ public:
// Return a vector of dmabuf file descriptors, exported for V4L2 buffer with |index|, assuming // Return a vector of dmabuf file descriptors, exported for V4L2 buffer with |index|, assuming
// the buffer contains |numPlanes| V4L2 planes and is of |bufType|. Return an empty vector on // the buffer contains |numPlanes| V4L2 planes and is of |bufType|. Return an empty vector on
// failure. The caller is responsible for closing the file descriptors after use. // failure. The caller is responsible for closing the file descriptors after use.
std::vector<base::ScopedFD> getDmabufsForV4L2Buffer(int index, size_t numPlanes, std::vector<::base::ScopedFD> getDmabufsForV4L2Buffer(int index, size_t numPlanes,
enum v4l2_buf_type bufType); enum v4l2_buf_type bufType);
// Returns the preferred V4L2 input formats for |type| or empty if none. // Returns the preferred V4L2 input formats for |type| or empty if none.
std::vector<uint32_t> preferredInputFormat(Type type); std::vector<uint32_t> preferredInputFormat(Type type);
...@@ -472,9 +473,9 @@ public: ...@@ -472,9 +473,9 @@ public:
// a buffer is ready to be dequeued and/or a V4L2 event has been posted. |errorCallback| will // a buffer is ready to be dequeued and/or a V4L2 event has been posted. |errorCallback| will
// be posted to the client's // be posted to the client's
// sequence if a polling error has occurred. // sequence if a polling error has occurred.
bool startPolling(scoped_refptr<base::SequencedTaskRunner> taskRunner, bool startPolling(scoped_refptr<::base::SequencedTaskRunner> taskRunner,
android::V4L2DevicePoller::EventCallback eventCallback, android::V4L2DevicePoller::EventCallback eventCallback,
base::RepeatingClosure errorCallback); ::base::RepeatingClosure errorCallback);
// Stop polling this V4L2Device if polling was active. No new events will be posted after this // Stop polling this V4L2Device if polling was active. No new events will be posted after this
// method has returned. // method has returned.
bool stopPolling(); bool stopPolling();
...@@ -503,7 +504,7 @@ private: ...@@ -503,7 +504,7 @@ private:
// Enumerate all V4L2 devices on the system for |type| and return them // Enumerate all V4L2 devices on the system for |type| and return them
static const DeviceInfos& getDeviceInfosForType(V4L2Device::Type type); static const DeviceInfos& getDeviceInfosForType(V4L2Device::Type type);
friend class base::RefCountedThreadSafe<V4L2Device>; friend class ::base::RefCountedThreadSafe<V4L2Device>;
V4L2Device(uint32_t debugStreamId); V4L2Device(uint32_t debugStreamId);
~V4L2Device(); ~V4L2Device();
...@@ -530,13 +531,13 @@ private: ...@@ -530,13 +531,13 @@ private:
uint32_t mDebugStreamId; uint32_t mDebugStreamId;
// The actual device fd. // The actual device fd.
base::ScopedFD mDeviceFd; ::base::ScopedFD mDeviceFd;
// eventfd fd to signal device poll thread when its poll() should be interrupted. // eventfd fd to signal device poll thread when its poll() should be interrupted.
base::ScopedFD mDevicePollInterruptFd; ::base::ScopedFD mDevicePollInterruptFd;
// Associates a v4l2_buf_type to its queue. // Associates a v4l2_buf_type to its queue.
base::flat_map<enum v4l2_buf_type, V4L2Queue*> mQueues; ::base::flat_map<enum v4l2_buf_type, V4L2Queue*> mQueues;
// Used if EnablePolling() is called to signal the user that an event happened or a buffer is // Used if EnablePolling() is called to signal the user that an event happened or a buffer is
// ready to be dequeued. // ready to be dequeued.
......
...@@ -32,12 +32,12 @@ class V4L2DevicePoller { ...@@ -32,12 +32,12 @@ class V4L2DevicePoller {
public: public:
// Callback to be called when buffer ready/V4L2 event has potentially been polled. |event| is // Callback to be called when buffer ready/V4L2 event has potentially been polled. |event| is
// set if a V4L2 event has been detected. // set if a V4L2 event has been detected.
using EventCallback = base::RepeatingCallback<void(bool event)>; using EventCallback = ::base::RepeatingCallback<void(bool event)>;
// Create a poller for |device|, using a thread named |threadName|. Notification won't start // Create a poller for |device|, using a thread named |threadName|. Notification won't start
// until |startPolling()| is called. // until |startPolling()| is called.
V4L2DevicePoller(V4L2Device* const device, const std::string& threadName, V4L2DevicePoller(V4L2Device* const device, const std::string& threadName,
scoped_refptr<base::SequencedTaskRunner> taskRunner); scoped_refptr<::base::SequencedTaskRunner> taskRunner);
~V4L2DevicePoller(); ~V4L2DevicePoller();
// Starts polling. |mEventCallback| will be posted on the caller's sequence every time an event // Starts polling. |mEventCallback| will be posted on the caller's sequence every time an event
...@@ -46,7 +46,7 @@ public: ...@@ -46,7 +46,7 @@ public:
// again in order to be notified for them. // again in order to be notified for them.
// //
// If an error occurs during polling, |mErrorCallback| will be posted on the caller's sequence. // If an error occurs during polling, |mErrorCallback| will be posted on the caller's sequence.
bool startPolling(EventCallback eventCallback, base::RepeatingClosure errorCallback); bool startPolling(EventCallback eventCallback, ::base::RepeatingClosure errorCallback);
// Stop polling and stop the thread. The poller won't post any new event to the caller's // Stop polling and stop the thread. The poller won't post any new event to the caller's
// sequence after this method has returned. // sequence after this method has returned.
bool stopPolling(); bool stopPolling();
...@@ -67,13 +67,13 @@ private: ...@@ -67,13 +67,13 @@ private:
// V4L2 device we are polling. // V4L2 device we are polling.
V4L2Device* const mDevice; V4L2Device* const mDevice;
// Thread on which polling is done. // Thread on which polling is done.
base::Thread mPollThread; ::base::Thread mPollThread;
// Callback to post to the client's sequence when an event occurs. // Callback to post to the client's sequence when an event occurs.
EventCallback mEventCallback; EventCallback mEventCallback;
// Closure to post to the client's sequence when an error occurs. // Closure to post to the client's sequence when an error occurs.
base::RepeatingClosure mErrorCallback; ::base::RepeatingClosure mErrorCallback;
// Client sequence's task runner, where closures are posted. // Client sequence's task runner, where closures are posted.
scoped_refptr<base::SequencedTaskRunner> mClientTaskTunner; scoped_refptr<::base::SequencedTaskRunner> mClientTaskTunner;
// Set to true when we wish to stop polling, instructing the poller thread to break its loop. // Set to true when we wish to stop polling, instructing the poller thread to break its loop.
std::atomic_bool mStopPolling; std::atomic_bool mStopPolling;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment