Use backticks not vertical bars to denote variables in comments for /modules/desktop_capture

Bug: webrtc:12338
Change-Id: I300ba78fc4423db7030e555d7e51d2cb2246e9a4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227162
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34678}
This commit is contained in:
Artem Titov 2021-07-28 23:35:39 +02:00 committed by WebRTC LUCI CQ
parent 1fd7af5fb8
commit cec4343fb4
91 changed files with 1468 additions and 1467 deletions

View file

@ -31,8 +31,8 @@ class BlankDetectorDesktopCapturerWrapper final
public DesktopCapturer::Callback {
public:
// Creates BlankDetectorDesktopCapturerWrapper. BlankDesktopCapturerWrapper
// takes ownership of |capturer|. The |blank_pixel| is the unmodified color
// returned by the |capturer|.
// takes ownership of `capturer`. The `blank_pixel` is the unmodified color
// returned by the `capturer`.
BlankDetectorDesktopCapturerWrapper(std::unique_ptr<DesktopCapturer> capturer,
RgbaColor blank_pixel);
~BlankDetectorDesktopCapturerWrapper() override;
@ -55,7 +55,7 @@ class BlankDetectorDesktopCapturerWrapper final
bool IsBlankFrame(const DesktopFrame& frame) const;
// Detects whether pixel at (x, y) equals to |blank_pixel_|.
// Detects whether pixel at (x, y) equals to `blank_pixel_`.
bool IsBlankPixel(const DesktopFrame& frame, int x, int y) const;
const std::unique_ptr<DesktopCapturer> capturer_;

View file

@ -19,11 +19,11 @@
namespace webrtc {
// Creates a DesktopFrame to contain only the area of |rect| in the original
// |frame|.
// |frame| should not be nullptr. |rect| is in |frame| coordinate, i.e.
// |frame|->top_left() does not impact the area of |rect|.
// Returns nullptr frame if |rect| is not contained by the bounds of |frame|.
// Creates a DesktopFrame to contain only the area of `rect` in the original
// `frame`.
// `frame` should not be nullptr. `rect` is in `frame` coordinate, i.e.
// `frame`->top_left() does not impact the area of `rect`.
// Returns nullptr frame if `rect` is not contained by the bounds of `frame`.
std::unique_ptr<DesktopFrame> RTC_EXPORT
CreateCroppedDesktopFrame(std::unique_ptr<DesktopFrame> frame,
const DesktopRect& rect);

View file

@ -25,7 +25,7 @@ std::unique_ptr<DesktopFrame> CreateTestFrame() {
TEST(CroppedDesktopFrameTest, DoNotCreateWrapperIfSizeIsNotChanged) {
std::unique_ptr<DesktopFrame> original = CreateTestFrame();
// owned by |original| and CroppedDesktopFrame.
// owned by `original` and CroppedDesktopFrame.
DesktopFrame* raw_original = original.get();
std::unique_ptr<DesktopFrame> cropped = CreateCroppedDesktopFrame(
std::move(original), DesktopRect::MakeWH(10, 20));

View file

@ -45,7 +45,7 @@ class RTC_EXPORT CroppingWindowCapturer : public DesktopCapturer,
bool FocusOnSelectedSource() override;
bool IsOccluded(const DesktopVector& pos) override;
// DesktopCapturer::Callback implementation, passed to |screen_capturer_| to
// DesktopCapturer::Callback implementation, passed to `screen_capturer_` to
// intercept the capture result.
void OnCaptureResult(DesktopCapturer::Result result,
std::unique_ptr<DesktopFrame> frame) override;

View file

@ -247,7 +247,7 @@ bool CroppingWindowCapturerWin::ShouldUseScreenCapturer() {
}
if (region_type == SIMPLEREGION) {
// The |region_rect| returned from GetRgnBox() is always in window
// The `region_rect` returned from GetRgnBox() is always in window
// coordinate.
region_rect.Translate(window_region_rect_.left(),
window_region_rect_.top());
@ -255,10 +255,10 @@ bool CroppingWindowCapturerWin::ShouldUseScreenCapturer() {
// system permits drawing.
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd144950(v=vs.85).aspx.
//
// |region_rect| should always be inside of |window_region_rect_|. So after
// the intersection, |window_region_rect_| == |region_rect|. If so, what's
// `region_rect` should always be inside of `window_region_rect_`. So after
// the intersection, `window_region_rect_` == `region_rect`. If so, what's
// the point of the intersecting operations? Why cannot we directly retrieve
// |window_region_rect_| from GetWindowRegionTypeWithBoundary() function?
// `window_region_rect_` from GetWindowRegionTypeWithBoundary() function?
// TODO(zijiehe): Figure out the purpose of these intersections.
window_region_rect_.IntersectWith(region_rect);
content_rect.IntersectWith(region_rect);
@ -266,14 +266,14 @@ bool CroppingWindowCapturerWin::ShouldUseScreenCapturer() {
// Check if the client area is out of the screen area. When the window is
// maximized, only its client area is visible in the screen, the border will
// be hidden. So we are using |content_rect| here.
// be hidden. So we are using `content_rect` here.
if (!GetFullscreenRect().ContainsRect(content_rect)) {
return false;
}
// Check if the window is occluded by any other window, excluding the child
// windows, context menus, and |excluded_window_|.
// |content_rect| is preferred, see the comments on
// windows, context menus, and `excluded_window_`.
// `content_rect` is preferred, see the comments on
// IsWindowIntersectWithSelectedWindow().
TopWindowVerifierContext context(selected,
reinterpret_cast<HWND>(excluded_window()),
@ -293,7 +293,7 @@ DesktopRect CroppingWindowCapturerWin::GetWindowRectInVirtualScreen() {
}
window_rect.IntersectWith(window_region_rect_);
// Convert |window_rect| to be relative to the top-left of the virtual screen.
// Convert `window_rect` to be relative to the top-left of the virtual screen.
DesktopRect screen_rect(GetFullscreenRect());
window_rect.IntersectWith(screen_rect);
window_rect.Translate(-screen_rect.left(), -screen_rect.top());

View file

@ -64,7 +64,7 @@ void AlphaBlend(uint8_t* dest,
// content before releasing the underlying frame.
class DesktopFrameWithCursor : public DesktopFrame {
public:
// Takes ownership of |frame|.
// Takes ownership of `frame`.
DesktopFrameWithCursor(std::unique_ptr<DesktopFrame> frame,
const MouseCursor& cursor,
const DesktopVector& position,
@ -113,7 +113,7 @@ DesktopFrameWithCursor::DesktopFrameWithCursor(
if (cursor_rect_.is_empty())
return;
// Copy original screen content under cursor to |restore_frame_|.
// Copy original screen content under cursor to `restore_frame_`.
restore_position_ = cursor_rect_.top_left();
restore_frame_.reset(new BasicDesktopFrame(cursor_rect_.size()));
restore_frame_->CopyPixelsFrom(*this, cursor_rect_.top_left(),
@ -218,7 +218,7 @@ void DesktopAndCursorComposer::OnCaptureResult(
// and location in logical(DIP) pixels on Retina monitor. This will cause
// problem when the desktop is mixed with Retina and non-Retina monitors.
// So we use DIP pixel for all location info and compensate with the scale
// factor of current frame to the |relative_position|.
// factor of current frame to the `relative_position`.
const float scale = frame->scale_factor();
relative_position.set(relative_position.x() * scale,
relative_position.y() * scale);

View file

@ -35,7 +35,7 @@ class RTC_EXPORT DesktopAndCursorComposer
public:
// Creates a new composer that captures mouse cursor using
// MouseCursorMonitor::Create(options) and renders it into the frames
// generated by |desktop_capturer|.
// generated by `desktop_capturer`.
DesktopAndCursorComposer(std::unique_ptr<DesktopCapturer> desktop_capturer,
const DesktopCaptureOptions& options);

View file

@ -201,7 +201,7 @@ class DesktopAndCursorComposerTest : public ::testing::Test,
}
protected:
// Owned by |blender_|.
// Owned by `blender_`.
FakeScreenCapturer* fake_screen_;
FakeMouseMonitor* fake_cursor_;
@ -280,7 +280,7 @@ TEST_F(DesktopAndCursorComposerTest, CursorShouldBeIgnoredIfFrameMayContainIt) {
fake_cursor_->SetState(MouseCursorMonitor::INSIDE, abs_pos);
blender_.CaptureFrame();
// If the frame may already have contained the cursor, then |CaptureFrame()|
// If the frame may already have contained the cursor, then `CaptureFrame()`
// should not have modified it, so it should be the same as the control.
EXPECT_TRUE(frame_);
const DesktopVector rel_pos(abs_pos.subtract(control_frame->top_left()));
@ -291,7 +291,7 @@ TEST_F(DesktopAndCursorComposerTest, CursorShouldBeIgnoredIfFrameMayContainIt) {
control_frame->GetFrameDataAtPos(rel_pos)));
} else {
// |CaptureFrame()| should have modified the frame to have the cursor.
// `CaptureFrame()` should have modified the frame to have the cursor.
EXPECT_NE(
*reinterpret_cast<uint32_t*>(frame_->GetFrameDataAtPos(rel_pos)),
*reinterpret_cast<uint32_t*>(

View file

@ -100,13 +100,13 @@ class RTC_EXPORT DesktopCaptureOptions {
#if defined(WEBRTC_WIN)
// Enumerating windows owned by the current process on Windows has some
// complications due to |GetWindowText*()| APIs potentially causing a
// deadlock (see the comments in the |GetWindowListHandler()| function in
// deadlock (see the comments in the `GetWindowListHandler()` function in
// window_capture_utils.cc for more details on the deadlock).
// To avoid this issue, consumers can either ensure that the thread that runs
// their message loop never waits on |GetSourceList()|, or they can set this
// their message loop never waits on `GetSourceList()`, or they can set this
// flag to false which will prevent windows running in the current process
// from being enumerated and included in the results. Consumers can still
// provide the WindowId for their own windows to |SelectSource()| and capture
// provide the WindowId for their own windows to `SelectSource()` and capture
// them.
bool enumerate_current_process_windows() const {
return enumerate_current_process_windows_;

View file

@ -39,7 +39,7 @@ const ScreenId kInvalidScreenId = -2;
// Integers to attach to each DesktopFrame to differentiate the generator of
// the frame. The entries in this namespace should remain in sync with the
// SequentialDesktopCapturerId enum, which is logged via UMA.
// |kScreenCapturerWinGdi| and |kScreenCapturerWinDirectx| values are preserved
// `kScreenCapturerWinGdi` and `kScreenCapturerWinDirectx` values are preserved
// to maintain compatibility
namespace DesktopCapturerId {
constexpr uint32_t CreateFourCC(char a, char b, char c, char d) {

View file

@ -50,8 +50,8 @@ class RTC_EXPORT DesktopCapturer {
// Interface that must be implemented by the DesktopCapturer consumers.
class Callback {
public:
// Called after a frame has been captured. |frame| is not nullptr if and
// only if |result| is SUCCESS.
// Called after a frame has been captured. `frame` is not nullptr if and
// only if `result` is SUCCESS.
virtual void OnCaptureResult(Result result,
std::unique_ptr<DesktopFrame> frame) = 0;
@ -77,7 +77,7 @@ class RTC_EXPORT DesktopCapturer {
virtual ~DesktopCapturer();
// Called at the beginning of a capturing session. |callback| must remain
// Called at the beginning of a capturing session. `callback` must remain
// valid until capturer is destroyed.
virtual void Start(Callback* callback) = 0;
@ -120,11 +120,11 @@ class RTC_EXPORT DesktopCapturer {
// implementation does not support this functionality.
virtual bool FocusOnSelectedSource();
// Returns true if the |pos| on the selected source is covered by other
// Returns true if the `pos` on the selected source is covered by other
// elements on the display, and is not visible to the users.
// |pos| is in full desktop coordinates, i.e. the top-left monitor always
// `pos` is in full desktop coordinates, i.e. the top-left monitor always
// starts from (0, 0).
// The return value if |pos| is out of the scope of the source is undefined.
// The return value if `pos` is out of the scope of the source is undefined.
virtual bool IsOccluded(const DesktopVector& pos);
// Creates a DesktopCapturer instance which targets to capture windows.

View file

@ -25,8 +25,8 @@ namespace webrtc {
namespace {
// Returns true if (0, 0) - (|width|, |height|) vector in |old_buffer| and
// |new_buffer| are equal. |width| should be less than 32
// Returns true if (0, 0) - (`width`, `height`) vector in `old_buffer` and
// `new_buffer` are equal. `width` should be less than 32
// (defined by kBlockSize), otherwise BlockDifference() should be used.
bool PartialBlockDifference(const uint8_t* old_buffer,
const uint8_t* new_buffer,
@ -45,9 +45,9 @@ bool PartialBlockDifference(const uint8_t* old_buffer,
return false;
}
// Compares columns in the range of [|left|, |right|), in a row in the
// range of [|top|, |top| + |height|), starts from |old_buffer| and
// |new_buffer|, and outputs updated regions into |output|. |stride| is the
// Compares columns in the range of [`left`, `right`), in a row in the
// range of [`top`, `top` + `height`), starts from `old_buffer` and
// `new_buffer`, and outputs updated regions into `output`. `stride` is the
// DesktopFrame::stride().
void CompareRow(const uint8_t* old_buffer,
const uint8_t* new_buffer,
@ -68,7 +68,7 @@ void CompareRow(const uint8_t* old_buffer,
// The first block-column in a continuous dirty area in current block-row.
int first_dirty_x_block = -1;
// We always need to add dirty area into |output| in the last block, so handle
// We always need to add dirty area into `output` in the last block, so handle
// it separatedly.
for (int x = 0; x < block_count; x++) {
if (BlockDifference(old_buffer, new_buffer, height, stride)) {
@ -109,8 +109,8 @@ void CompareRow(const uint8_t* old_buffer,
}
}
// Compares |rect| area in |old_frame| and |new_frame|, and outputs dirty
// regions into |output|.
// Compares `rect` area in `old_frame` and `new_frame`, and outputs dirty
// regions into `output`.
void CompareFrames(const DesktopFrame& old_frame,
const DesktopFrame& new_frame,
DesktopRect rect,

View file

@ -29,9 +29,9 @@ namespace webrtc {
namespace {
// Compares and asserts |frame|.updated_region() equals to |rects|. This
// function does not care about the order of the |rects| and it does not expect
// DesktopRegion to return an exact area for each rectangle in |rects|.
// Compares and asserts `frame`.updated_region() equals to `rects`. This
// function does not care about the order of the `rects` and it does not expect
// DesktopRegion to return an exact area for each rectangle in `rects`.
template <template <typename, typename...> class T = std::initializer_list,
typename... Rect>
void AssertUpdatedRegionIs(const DesktopFrame& frame,
@ -43,10 +43,10 @@ void AssertUpdatedRegionIs(const DesktopFrame& frame,
ASSERT_TRUE(frame.updated_region().Equals(region));
}
// Compares and asserts |frame|.updated_region() covers all rectangles in
// |rects|, but does not cover areas other than a kBlockSize expansion. This
// function does not care about the order of the |rects|, and it does not expect
// DesktopRegion to return an exact area of each rectangle in |rects|.
// Compares and asserts `frame`.updated_region() covers all rectangles in
// `rects`, but does not cover areas other than a kBlockSize expansion. This
// function does not care about the order of the `rects`, and it does not expect
// DesktopRegion to return an exact area of each rectangle in `rects`.
template <template <typename, typename...> class T = std::initializer_list,
typename... Rect>
void AssertUpdatedRegionCovers(const DesktopFrame& frame,
@ -56,13 +56,13 @@ void AssertUpdatedRegionCovers(const DesktopFrame& frame,
region.AddRect(rect);
}
// Intersect of |rects| and |frame|.updated_region() should be |rects|. i.e.
// |frame|.updated_region() should be a superset of |rects|.
// Intersect of `rects` and `frame`.updated_region() should be `rects`. i.e.
// `frame`.updated_region() should be a superset of `rects`.
DesktopRegion intersect(region);
intersect.IntersectWith(frame.updated_region());
ASSERT_TRUE(region.Equals(intersect));
// Difference between |rects| and |frame|.updated_region() should not cover
// Difference between `rects` and `frame`.updated_region() should not cover
// areas which have larger than twice of kBlockSize width and height.
//
// Explanation of the 'twice' of kBlockSize (indeed kBlockSize * 2 - 2) is
@ -106,8 +106,8 @@ void AssertUpdatedRegionCovers(const DesktopFrame& frame,
}
// Executes a DesktopCapturerDifferWrapper::Capture() and compares its output
// DesktopFrame::updated_region() with |updated_region| if |check_result| is
// true. If |exactly_match| is true, AssertUpdatedRegionIs() will be used,
// DesktopFrame::updated_region() with `updated_region` if `check_result` is
// true. If `exactly_match` is true, AssertUpdatedRegionIs() will be used,
// otherwise AssertUpdatedRegionCovers() will be used.
template <template <typename, typename...> class T = std::initializer_list,
typename... Rect>

View file

@ -85,7 +85,7 @@ class RTC_EXPORT DesktopFrame {
int64_t capture_time_ms() const { return capture_time_ms_; }
void set_capture_time_ms(int64_t time_ms) { capture_time_ms_ = time_ms; }
// Copies pixels from a buffer or another frame. |dest_rect| rect must lay
// Copies pixels from a buffer or another frame. `dest_rect` rect must lay
// within bounds of this frame.
void CopyPixelsFrom(const uint8_t* src_buffer,
int src_stride,
@ -113,21 +113,21 @@ class RTC_EXPORT DesktopFrame {
uint32_t capturer_id() const { return capturer_id_; }
void set_capturer_id(uint32_t capturer_id) { capturer_id_ = capturer_id; }
// Copies various information from |other|. Anything initialized in
// Copies various information from `other`. Anything initialized in
// constructor are not copied.
// This function is usually used when sharing a source DesktopFrame with
// several clients: the original DesktopFrame should be kept unchanged. For
// example, BasicDesktopFrame::CopyOf() and SharedDesktopFrame::Share().
void CopyFrameInfoFrom(const DesktopFrame& other);
// Copies various information from |other|. Anything initialized in
// Copies various information from `other`. Anything initialized in
// constructor are not copied. Not like CopyFrameInfoFrom() function, this
// function uses swap or move constructor to avoid data copy. It won't break
// the |other|, but some of its information may be missing after this
// the `other`, but some of its information may be missing after this
// operation. E.g. other->updated_region_;
// This function is usually used when wrapping a DesktopFrame: the wrapper
// instance takes the ownership of |other|, so other components cannot access
// |other| anymore. For example, CroppedDesktopFrame and
// instance takes the ownership of `other`, so other components cannot access
// `other` anymore. For example, CroppedDesktopFrame and
// DesktopFrameWithCursor.
void MoveFrameInfoFrom(DesktopFrame* other);
@ -175,7 +175,7 @@ class RTC_EXPORT BasicDesktopFrame : public DesktopFrame {
~BasicDesktopFrame() override;
// Creates a BasicDesktopFrame that contains copy of |frame|.
// Creates a BasicDesktopFrame that contains copy of `frame`.
// TODO(zijiehe): Return std::unique_ptr<DesktopFrame>
static DesktopFrame* CopyOf(const DesktopFrame& frame);
@ -186,14 +186,14 @@ class RTC_EXPORT BasicDesktopFrame : public DesktopFrame {
// A DesktopFrame that stores data in shared memory.
class RTC_EXPORT SharedMemoryDesktopFrame : public DesktopFrame {
public:
// May return nullptr if |shared_memory_factory| failed to create a
// May return nullptr if `shared_memory_factory` failed to create a
// SharedMemory instance.
// |shared_memory_factory| should not be nullptr.
// `shared_memory_factory` should not be nullptr.
static std::unique_ptr<DesktopFrame> Create(
DesktopSize size,
SharedMemoryFactory* shared_memory_factory);
// Takes ownership of |shared_memory|.
// Takes ownership of `shared_memory`.
// Deprecated, use the next constructor.
SharedMemoryDesktopFrame(DesktopSize size,
int stride,

View file

@ -24,11 +24,11 @@ namespace webrtc {
namespace {
// Sets |updated_region| to |frame|. If |enlarge_updated_region| is
// Sets `updated_region` to `frame`. If `enlarge_updated_region` is
// true, this function will randomly enlarge each DesktopRect in
// |updated_region|. But the enlarged DesktopRegion won't excceed the
// frame->size(). If |add_random_updated_region| is true, several random
// rectangles will also be included in |frame|.
// `updated_region`. But the enlarged DesktopRegion won't excceed the
// frame->size(). If `add_random_updated_region` is true, several random
// rectangles will also be included in `frame`.
void SetUpdatedRegion(DesktopFrame* frame,
const DesktopRegion& updated_region,
bool enlarge_updated_region,
@ -61,7 +61,7 @@ void SetUpdatedRegion(DesktopFrame* frame,
}
}
// Paints pixels in |rect| of |frame| to |color|.
// Paints pixels in `rect` of `frame` to `color`.
void PaintRect(DesktopFrame* frame, DesktopRect rect, RgbaColor rgba_color) {
static_assert(DesktopFrame::kBytesPerPixel == sizeof(uint32_t),
"kBytesPerPixel should be 4.");
@ -78,7 +78,7 @@ void PaintRect(DesktopFrame* frame, DesktopRect rect, RgbaColor rgba_color) {
}
}
// Paints pixels in |region| of |frame| to |color|.
// Paints pixels in `region` of `frame` to `color`.
void PaintRegion(DesktopFrame* frame,
DesktopRegion* region,
RgbaColor rgba_color) {

View file

@ -71,9 +71,9 @@ class PainterDesktopFrameGenerator final : public DesktopFrameGenerator {
// regions' return from OS APIs.
void set_enlarge_updated_region(bool enlarge_updated_region);
// The range to enlarge a updated region if |enlarge_updated_region_| is true.
// The range to enlarge a updated region if `enlarge_updated_region_` is true.
// If this field is less than zero, it will be treated as zero, and
// |enlarge_updated_region_| will be ignored.
// `enlarge_updated_region_` will be ignored.
void set_enlarge_range(int enlarge_range);
// Decides whether BaseDesktopFrameGenerator randomly add some updated regions
@ -81,10 +81,10 @@ class PainterDesktopFrameGenerator final : public DesktopFrameGenerator {
// updated regions' return from OS APIs.
void set_add_random_updated_region(bool add_random_updated_region);
// Sets the painter object to do the real painting work, if no |painter_| has
// Sets the painter object to do the real painting work, if no `painter_` has
// been set to this instance, the DesktopFrame returned by GetNextFrame()
// function will keep in an undefined but valid state.
// PainterDesktopFrameGenerator does not take ownership of the |painter|.
// PainterDesktopFrameGenerator does not take ownership of the `painter`.
void set_desktop_frame_painter(DesktopFramePainter* painter);
private:

View file

@ -97,7 +97,7 @@ void RotateDesktopFrame(const DesktopFrame& source,
DesktopFrame* target) {
RTC_DCHECK(target);
RTC_DCHECK(DesktopRect::MakeSize(source.size()).ContainsRect(source_rect));
// The rectangle in |target|.
// The rectangle in `target`.
const DesktopRect target_rect =
RotateAndOffsetRect(source_rect, source.size(), rotation, target_offset);
RTC_DCHECK(DesktopRect::MakeSize(target->size()).ContainsRect(target_rect));

View file

@ -24,27 +24,27 @@ enum class Rotation {
CLOCK_WISE_270,
};
// Rotates input DesktopFrame |source|, copies pixel in an unrotated rectangle
// |source_rect| into the target rectangle of another DesktopFrame |target|.
// Target rectangle here is the rotated |source_rect| plus |target_offset|.
// |rotation| specifies |source| to |target| rotation. |source_rect| is in
// |source| coordinate. |target_offset| is in |target| coordinate.
// This function triggers check failure if |source| does not cover the
// |source_rect|, or |target| does not cover the rotated |rect|.
// Rotates input DesktopFrame `source`, copies pixel in an unrotated rectangle
// `source_rect` into the target rectangle of another DesktopFrame `target`.
// Target rectangle here is the rotated `source_rect` plus `target_offset`.
// `rotation` specifies `source` to `target` rotation. `source_rect` is in
// `source` coordinate. `target_offset` is in `target` coordinate.
// This function triggers check failure if `source` does not cover the
// `source_rect`, or `target` does not cover the rotated `rect`.
void RotateDesktopFrame(const DesktopFrame& source,
const DesktopRect& source_rect,
const Rotation& rotation,
const DesktopVector& target_offset,
DesktopFrame* target);
// Returns a reverse rotation of |rotation|.
// Returns a reverse rotation of `rotation`.
Rotation ReverseRotation(Rotation rotation);
// Returns a rotated DesktopSize of |size|.
// Returns a rotated DesktopSize of `size`.
DesktopSize RotateSize(DesktopSize size, Rotation rotation);
// Returns a rotated DesktopRect of |rect|. The |size| represents the size of
// the DesktopFrame which |rect| belongs in.
// Returns a rotated DesktopRect of `rect`. The `size` represents the size of
// the DesktopFrame which `rect` belongs in.
DesktopRect RotateRect(DesktopRect rect, DesktopSize size, Rotation rotation);
} // namespace webrtc

View file

@ -123,35 +123,35 @@ class RTC_EXPORT DesktopRect {
right_ == other.right_ && bottom_ == other.bottom_;
}
// Returns true if |point| lies within the rectangle boundaries.
// Returns true if `point` lies within the rectangle boundaries.
bool Contains(const DesktopVector& point) const;
// Returns true if |rect| lies within the boundaries of this rectangle.
// Returns true if `rect` lies within the boundaries of this rectangle.
bool ContainsRect(const DesktopRect& rect) const;
// Finds intersection with |rect|.
// Finds intersection with `rect`.
void IntersectWith(const DesktopRect& rect);
// Extends the rectangle to cover |rect|. If |this| is empty, replaces |this|
// with |rect|; if |rect| is empty, this function takes no effect.
// Extends the rectangle to cover `rect`. If `this` is empty, replaces `this`
// with `rect`; if `rect` is empty, this function takes no effect.
void UnionWith(const DesktopRect& rect);
// Adds (dx, dy) to the position of the rectangle.
void Translate(int32_t dx, int32_t dy);
void Translate(DesktopVector d) { Translate(d.x(), d.y()); }
// Enlarges current DesktopRect by subtracting |left_offset| and |top_offset|
// from |left_| and |top_|, and adding |right_offset| and |bottom_offset| to
// |right_| and |bottom_|. This function does not normalize the result, so
// |left_| and |top_| may be less than zero or larger than |right_| and
// |bottom_|.
// Enlarges current DesktopRect by subtracting `left_offset` and `top_offset`
// from `left_` and `top_`, and adding `right_offset` and `bottom_offset` to
// `right_` and `bottom_`. This function does not normalize the result, so
// `left_` and `top_` may be less than zero or larger than `right_` and
// `bottom_`.
void Extend(int32_t left_offset,
int32_t top_offset,
int32_t right_offset,
int32_t bottom_offset);
// Scales current DesktopRect. This function does not impact the |top_| and
// |left_|.
// Scales current DesktopRect. This function does not impact the `top_` and
// `left_`.
void Scale(double horizontal, double vertical);
private:

View file

@ -90,24 +90,24 @@ void DesktopRegion::AddRect(const DesktopRect& rect) {
if (rect.is_empty())
return;
// Top of the part of the |rect| that hasn't been inserted yet. Increased as
// Top of the part of the `rect` that hasn't been inserted yet. Increased as
// we iterate over the rows until it reaches |rect.bottom()|.
int top = rect.top();
// Iterate over all rows that may intersect with |rect| and add new rows when
// Iterate over all rows that may intersect with `rect` and add new rows when
// necessary.
Rows::iterator row = rows_.upper_bound(top);
while (top < rect.bottom()) {
if (row == rows_.end() || top < row->second->top) {
// If |top| is above the top of the current |row| then add a new row above
// If `top` is above the top of the current `row` then add a new row above
// the current one.
int32_t bottom = rect.bottom();
if (row != rows_.end() && row->second->top < bottom)
bottom = row->second->top;
row = rows_.insert(row, Rows::value_type(bottom, new Row(top, bottom)));
} else if (top > row->second->top) {
// If the |top| falls in the middle of the |row| then split |row| into
// two, at |top|, and leave |row| referring to the lower of the two,
// If the `top` falls in the middle of the `row` then split `row` into
// two, at `top`, and leave `row` referring to the lower of the two,
// ready to insert a new span into.
RTC_DCHECK_LE(top, row->second->bottom);
Rows::iterator new_row = rows_.insert(
@ -117,8 +117,8 @@ void DesktopRegion::AddRect(const DesktopRect& rect) {
}
if (rect.bottom() < row->second->bottom) {
// If the bottom of the |rect| falls in the middle of the |row| split
// |row| into two, at |top|, and leave |row| referring to the upper of
// If the bottom of the `rect` falls in the middle of the `row` split
// `row` into two, at `top`, and leave `row` referring to the upper of
// the two, ready to insert a new span into.
Rows::iterator new_row = rows_.insert(
row, Rows::value_type(rect.bottom(), new Row(top, rect.bottom())));
@ -154,7 +154,7 @@ void DesktopRegion::MergeWithPrecedingRow(Rows::iterator row) {
Rows::iterator previous_row = row;
previous_row--;
// If |row| and |previous_row| are next to each other and contain the same
// If `row` and `previous_row` are next to each other and contain the same
// set of spans then they can be merged.
if (previous_row->second->bottom == row->second->top &&
previous_row->second->spans == row->second->spans) {
@ -185,20 +185,20 @@ void DesktopRegion::Intersect(const DesktopRegion& region1,
return;
while (it1 != end1 && it2 != end2) {
// Arrange for |it1| to always be the top-most of the rows.
// Arrange for `it1` to always be the top-most of the rows.
if (it2->second->top < it1->second->top) {
std::swap(it1, it2);
std::swap(end1, end2);
}
// Skip |it1| if it doesn't intersect |it2| at all.
// Skip `it1` if it doesn't intersect `it2` at all.
if (it1->second->bottom <= it2->second->top) {
++it1;
continue;
}
// Top of the |it1| row is above the top of |it2|, so top of the
// intersection is always the top of |it2|.
// Top of the `it1` row is above the top of `it2`, so top of the
// intersection is always the top of `it2`.
int32_t top = it2->second->top;
int32_t bottom = std::min(it1->second->bottom, it2->second->bottom);
@ -213,10 +213,10 @@ void DesktopRegion::Intersect(const DesktopRegion& region1,
MergeWithPrecedingRow(new_row);
}
// If |it1| was completely consumed, move to the next one.
// If `it1` was completely consumed, move to the next one.
if (it1->second->bottom == bottom)
++it1;
// If |it2| was completely consumed, move to the next one.
// If `it2` was completely consumed, move to the next one.
if (it2->second->bottom == bottom)
++it2;
}
@ -233,13 +233,13 @@ void DesktopRegion::IntersectRows(const RowSpanSet& set1,
RTC_DCHECK(it1 != end1 && it2 != end2);
do {
// Arrange for |it1| to always be the left-most of the spans.
// Arrange for `it1` to always be the left-most of the spans.
if (it2->left < it1->left) {
std::swap(it1, it2);
std::swap(end1, end2);
}
// Skip |it1| if it doesn't intersect |it2| at all.
// Skip `it1` if it doesn't intersect `it2` at all.
if (it1->right <= it2->left) {
++it1;
continue;
@ -251,10 +251,10 @@ void DesktopRegion::IntersectRows(const RowSpanSet& set1,
output->push_back(RowSpan(left, right));
// If |it1| was completely consumed, move to the next one.
// If `it1` was completely consumed, move to the next one.
if (it1->right == right)
++it1;
// If |it2| was completely consumed, move to the next one.
// If `it2` was completely consumed, move to the next one.
if (it2->right == right)
++it2;
} while (it1 != end1 && it2 != end2);
@ -276,20 +276,20 @@ void DesktopRegion::Subtract(const DesktopRegion& region) {
if (region.rows_.empty())
return;
// |row_b| refers to the current row being subtracted.
// `row_b` refers to the current row being subtracted.
Rows::const_iterator row_b = region.rows_.begin();
// Current vertical position at which subtraction is happening.
int top = row_b->second->top;
// |row_a| refers to the current row we are subtracting from. Skip all rows
// above |top|.
// `row_a` refers to the current row we are subtracting from. Skip all rows
// above `top`.
Rows::iterator row_a = rows_.upper_bound(top);
// Step through rows of the both regions subtracting content of |row_b| from
// |row_a|.
// Step through rows of the both regions subtracting content of `row_b` from
// `row_a`.
while (row_a != rows_.end() && row_b != region.rows_.end()) {
// Skip |row_a| if it doesn't intersect with the |row_b|.
// Skip `row_a` if it doesn't intersect with the `row_b`.
if (row_a->second->bottom <= top) {
// Each output row is merged with previously-processed rows before further
// rows are processed.
@ -299,8 +299,8 @@ void DesktopRegion::Subtract(const DesktopRegion& region) {
}
if (top > row_a->second->top) {
// If |top| falls in the middle of |row_a| then split |row_a| into two, at
// |top|, and leave |row_a| referring to the lower of the two, ready to
// If `top` falls in the middle of `row_a` then split `row_a` into two, at
// `top`, and leave `row_a` referring to the lower of the two, ready to
// subtract spans from.
RTC_DCHECK_LE(top, row_a->second->bottom);
Rows::iterator new_row = rows_.insert(
@ -308,8 +308,8 @@ void DesktopRegion::Subtract(const DesktopRegion& region) {
row_a->second->top = top;
new_row->second->spans = row_a->second->spans;
} else if (top < row_a->second->top) {
// If the |top| is above |row_a| then skip the range between |top| and
// top of |row_a| because it's empty.
// If the `top` is above `row_a` then skip the range between `top` and
// top of `row_a` because it's empty.
top = row_a->second->top;
if (top >= row_b->second->bottom) {
++row_b;
@ -320,8 +320,8 @@ void DesktopRegion::Subtract(const DesktopRegion& region) {
}
if (row_b->second->bottom < row_a->second->bottom) {
// If the bottom of |row_b| falls in the middle of the |row_a| split
// |row_a| into two, at |top|, and leave |row_a| referring to the upper of
// If the bottom of `row_b` falls in the middle of the `row_a` split
// `row_a` into two, at `top`, and leave `row_a` referring to the upper of
// the two, ready to subtract spans from.
int bottom = row_b->second->bottom;
Rows::iterator new_row =
@ -331,8 +331,8 @@ void DesktopRegion::Subtract(const DesktopRegion& region) {
row_a = new_row;
}
// At this point the vertical range covered by |row_a| lays within the
// range covered by |row_b|. Subtract |row_b| spans from |row_a|.
// At this point the vertical range covered by `row_a` lays within the
// range covered by `row_b`. Subtract `row_b` spans from `row_a`.
RowSpanSet new_spans;
SubtractRows(row_a->second->spans, row_b->second->spans, &new_spans);
new_spans.swap(row_a->second->spans);
@ -417,12 +417,12 @@ void DesktopRegion::AddSpanToRow(Row* row, int left, int right) {
return;
}
// Find the first span that ends at or after |left|.
// Find the first span that ends at or after `left`.
RowSpanSet::iterator start = std::lower_bound(
row->spans.begin(), row->spans.end(), left, CompareSpanRight);
RTC_DCHECK(start < row->spans.end());
// Find the first span that starts after |right|.
// Find the first span that starts after `right`.
RowSpanSet::iterator end =
std::lower_bound(start, row->spans.end(), right + 1, CompareSpanLeft);
if (end == row->spans.begin()) {
@ -432,7 +432,7 @@ void DesktopRegion::AddSpanToRow(Row* row, int left, int right) {
}
// Move end to the left, so that it points the last span that ends at or
// before |right|.
// before `right`.
end--;
// At this point [start, end] is the range of spans that intersect with the
@ -471,8 +471,8 @@ void DesktopRegion::SubtractRows(const RowSpanSet& set_a,
RowSpanSet::const_iterator it_b = set_b.begin();
// Iterate over all spans in |set_a| adding parts of it that do not intersect
// with |set_b| to the |output|.
// Iterate over all spans in `set_a` adding parts of it that do not intersect
// with `set_b` to the `output`.
for (RowSpanSet::const_iterator it_a = set_a.begin(); it_a != set_a.end();
++it_a) {
// If there is no intersection then append the current span and continue.
@ -481,7 +481,7 @@ void DesktopRegion::SubtractRows(const RowSpanSet& set_a,
continue;
}
// Iterate over |set_b| spans that may intersect with |it_a|.
// Iterate over `set_b` spans that may intersect with `it_a`.
int pos = it_a->left;
while (it_b != set_b.end() && it_b->left < it_a->right) {
if (it_b->left > pos)

View file

@ -80,9 +80,9 @@ class RTC_EXPORT DesktopRegion {
private:
const DesktopRegion& region_;
// Updates |rect_| based on the current |row_| and |row_span_|. If
// |row_span_| matches spans on consecutive rows then they are also merged
// into |rect_|, to generate more efficient output.
// Updates `rect_` based on the current `row_` and `row_span_`. If
// `row_span_` matches spans on consecutive rows then they are also merged
// into `rect_`, to generate more efficient output.
void UpdateCurrentRect();
Rows::const_iterator row_;
@ -106,7 +106,7 @@ class RTC_EXPORT DesktopRegion {
// Reset the region to be empty.
void Clear();
// Reset region to contain just |rect|.
// Reset region to contain just `rect`.
void SetRect(const DesktopRect& rect);
// Adds specified rect(s) or region to the region.
@ -117,16 +117,16 @@ class RTC_EXPORT DesktopRegion {
// Finds intersection of two regions and stores them in the current region.
void Intersect(const DesktopRegion& region1, const DesktopRegion& region2);
// Same as above but intersects content of the current region with |region|.
// Same as above but intersects content of the current region with `region`.
void IntersectWith(const DesktopRegion& region);
// Clips the region by the |rect|.
// Clips the region by the `rect`.
void IntersectWith(const DesktopRect& rect);
// Subtracts |region| from the current content of the region.
// Subtracts `region` from the current content of the region.
void Subtract(const DesktopRegion& region);
// Subtracts |rect| from the current content of the region.
// Subtracts `rect` from the current content of the region.
void Subtract(const DesktopRect& rect);
// Adds (dx, dy) to the position of the region.
@ -136,14 +136,14 @@ class RTC_EXPORT DesktopRegion {
private:
// Comparison functions used for std::lower_bound(). Compare left or right
// edges withs a given |value|.
// edges withs a given `value`.
static bool CompareSpanLeft(const RowSpan& r, int32_t value);
static bool CompareSpanRight(const RowSpan& r, int32_t value);
// Adds a new span to the row, coalescing spans if necessary.
static void AddSpanToRow(Row* row, int32_t left, int32_t right);
// Returns true if the |span| exists in the given |row|.
// Returns true if the `span` exists in the given `row`.
static bool IsSpanInRow(const Row& row, const RowSpan& rect);
// Calculates the intersection of two sets of spans.
@ -155,9 +155,9 @@ class RTC_EXPORT DesktopRegion {
const RowSpanSet& set_b,
RowSpanSet* output);
// Merges |row| with the row above it if they contain the same spans. Doesn't
// do anything if called with |row| set to rows_.begin() (i.e. first row of
// the region). If the rows were merged |row| remains a valid iterator to the
// Merges `row` with the row above it if they contain the same spans. Doesn't
// do anything if called with `row` set to rows_.begin() (i.e. first row of
// the region). If the rows were merged `row` remains a valid iterator to the
// merged row.
void MergeWithPrecedingRow(Rows::iterator row);

View file

@ -27,7 +27,7 @@ const int kBytesPerPixel = 4;
bool VectorDifference(const uint8_t* image1, const uint8_t* image2);
// Low level function to compare 2 blocks of pixels of size
// (kBlockSize, |height|). Returns whether the blocks differ.
// (kBlockSize, `height`). Returns whether the blocks differ.
bool BlockDifference(const uint8_t* image1,
const uint8_t* image2,
int height,

View file

@ -32,9 +32,9 @@ int FakeDesktopCapturer::num_capture_attempts() const {
return num_capture_attempts_;
}
// Uses the |generator| provided as DesktopFrameGenerator, FakeDesktopCapturer
// Uses the `generator` provided as DesktopFrameGenerator, FakeDesktopCapturer
// does
// not take the ownership of |generator|.
// not take the ownership of `generator`.
void FakeDesktopCapturer::set_frame_generator(
DesktopFrameGenerator* generator) {
generator_ = generator;

View file

@ -39,8 +39,8 @@ class RTC_EXPORT FakeDesktopCapturer : public DesktopCapturer {
// Decides the result which will be returned in next Capture() callback.
void set_result(DesktopCapturer::Result result);
// Uses the |generator| provided as DesktopFrameGenerator, FakeDesktopCapturer
// does not take the ownership of |generator|.
// Uses the `generator` provided as DesktopFrameGenerator, FakeDesktopCapturer
// does not take the ownership of `generator`.
void set_frame_generator(DesktopFrameGenerator* generator);
// Count of DesktopFrame(s) have been returned by this instance. This field

View file

@ -27,13 +27,13 @@ namespace {
// implementations only.
class SharedMemoryFactoryProxy : public SharedMemoryFactory {
public:
// Users should maintain the lifetime of |factory| to ensure it overlives
// Users should maintain the lifetime of `factory` to ensure it overlives
// current instance.
static std::unique_ptr<SharedMemoryFactory> Create(
SharedMemoryFactory* factory);
~SharedMemoryFactoryProxy() override;
// Forwards CreateSharedMemory() calls to |factory_|. Users should always call
// Forwards CreateSharedMemory() calls to `factory_`. Users should always call
// this function in one thread. Users should not call this function after the
// SharedMemoryFactory which current instance created from has been destroyed.
std::unique_ptr<SharedMemory> CreateSharedMemory(size_t size) override;
@ -88,7 +88,7 @@ void FallbackDesktopCapturerWrapper::Start(
main_capturer_->Start(this);
// For the secondary capturer, we do not have a backup plan anymore, so
// FallbackDesktopCapturerWrapper won't check its return value any more. It
// will directly return to the input |callback|.
// will directly return to the input `callback`.
secondary_capturer_->Start(callback);
}

View file

@ -36,7 +36,7 @@ namespace {
// window managers may re-parent them to add decorations. However,
// XQueryPointer() expects to be passed children of the root. This function
// searches up the list of the windows to find the root child that corresponds
// to |window|.
// to `window`.
Window GetTopLevelWindow(Display* display, Window window) {
while (true) {
// If the window is in WithdrawnState then look at all of its children.
@ -153,17 +153,17 @@ void MouseCursorMonitorX11::Capture() {
state = OUTSIDE;
} else {
// In screen mode (window_ == root_window) the mouse is always inside.
// XQueryPointer() sets |child_window| to None if the cursor is outside
// |window_|.
// XQueryPointer() sets `child_window` to None if the cursor is outside
// `window_`.
state =
(window_ == root_window || child_window != None) ? INSIDE : OUTSIDE;
}
// As the comments to GetTopLevelWindow() above indicate, in window capture,
// the cursor position capture happens in |window_|, while the frame catpure
// happens in |child_window|. These two windows are not alwyas same, as
// window manager may add some decorations to the |window_|. So translate
// the coordinate in |window_| to the coordinate space of |child_window|.
// the cursor position capture happens in `window_`, while the frame catpure
// happens in `child_window`. These two windows are not alwyas same, as
// window manager may add some decorations to the `window_`. So translate
// the coordinate in `window_` to the coordinate space of `child_window`.
if (window_ != root_window && state == INSIDE) {
int translated_x, translated_y;
Window unused;

View file

@ -48,7 +48,7 @@ class MouseCursorMonitorX11 : public MouseCursorMonitor,
Display* display() { return x_display_->display(); }
// Captures current cursor shape and stores it in |cursor_shape_|.
// Captures current cursor shape and stores it in `cursor_shape_`.
void CaptureCursor();
rtc::scoped_refptr<SharedXDisplay> x_display_;

View file

@ -234,7 +234,7 @@ void ScreenCapturerX11::CaptureFrame() {
options_.x_display()->ProcessPendingXEvents();
// ProcessPendingXEvents() may call ScreenConfigurationChanged() which
// reinitializes |x_server_pixel_buffer_|. Check if the pixel buffer is still
// reinitializes `x_server_pixel_buffer_`. Check if the pixel buffer is still
// in a good shape.
if (!x_server_pixel_buffer_.is_initialized()) {
// We failed to initialize pixel buffer.
@ -276,7 +276,7 @@ bool ScreenCapturerX11::GetSourceList(SourceList* sources) {
return true;
}
// Ensure that |monitors_| is updated with changes that may have happened
// Ensure that `monitors_` is updated with changes that may have happened
// between calls to GetSourceList().
options_.x_display()->ProcessPendingXEvents();
@ -350,7 +350,7 @@ std::unique_ptr<DesktopFrame> ScreenCapturerX11::CaptureScreen() {
// In the DAMAGE case, ensure the frame is up-to-date with the previous frame
// if any. If there isn't a previous frame, that means a screen-resolution
// change occurred, and |invalid_rects| will be updated to include the whole
// change occurred, and `invalid_rects` will be updated to include the whole
// screen.
if (use_damage_ && queue_.previous_frame())
SynchronizeFrame();
@ -419,7 +419,7 @@ void ScreenCapturerX11::SynchronizeFrame() {
// positives.
// TODO(hclam): We can reduce the amount of copying here by subtracting
// |capturer_helper_|s region from |last_invalid_region_|.
// `capturer_helper_`s region from `last_invalid_region_`.
// http://crbug.com/92354
RTC_DCHECK(queue_.previous_frame());

View file

@ -78,10 +78,10 @@ class ScreenCapturerX11 : public DesktopCapturer,
// Called when the screen configuration is changed.
void ScreenConfigurationChanged();
// Synchronize the current buffer with |last_buffer_|, by copying pixels from
// the area of |last_invalid_rects|.
// Synchronize the current buffer with `last_buffer_`, by copying pixels from
// the area of `last_invalid_rects`.
// Note this only works on the assumption that kNumBuffers == 2, as
// |last_invalid_rects| holds the differences from the previous buffer and
// `last_invalid_rects` holds the differences from the previous buffer and
// the one prior to that (which will then be the current buffer).
void SynchronizeFrame();

View file

@ -65,7 +65,7 @@ void SharedXDisplay::RemoveEventHandler(int type, XEventHandler* handler) {
}
void SharedXDisplay::ProcessPendingXEvents() {
// Hold reference to |this| to prevent it from being destroyed while
// Hold reference to `this` to prevent it from being destroyed while
// processing events.
rtc::scoped_refptr<SharedXDisplay> self(this);

View file

@ -39,8 +39,8 @@ class RTC_EXPORT SharedXDisplay
virtual bool HandleXEvent(const XEvent& event) = 0;
};
// Creates a new X11 Display for the |display_name|. NULL is returned if X11
// connection failed. Equivalent to CreateDefault() when |display_name| is
// Creates a new X11 Display for the `display_name`. NULL is returned if X11
// connection failed. Equivalent to CreateDefault() when `display_name` is
// empty.
static rtc::scoped_refptr<SharedXDisplay> Create(
const std::string& display_name);
@ -51,11 +51,11 @@ class RTC_EXPORT SharedXDisplay
Display* display() { return display_; }
// Adds a new event |handler| for XEvent's of |type|.
// Adds a new event `handler` for XEvent's of `type`.
void AddEventHandler(int type, XEventHandler* handler);
// Removes event |handler| added using |AddEventHandler|. Doesn't do anything
// if |handler| is not registered.
// Removes event `handler` added using `AddEventHandler`. Doesn't do anything
// if `handler` is not registered.
void RemoveEventHandler(int type, XEventHandler* handler);
// Processes pending XEvents, calling corresponding event handlers.
@ -66,7 +66,7 @@ class RTC_EXPORT SharedXDisplay
~SharedXDisplay();
protected:
// Takes ownership of |display|.
// Takes ownership of `display`.
explicit SharedXDisplay(Display* display);
private:

View file

@ -52,7 +52,7 @@ class WindowCapturerX11 : public DesktopCapturer,
private:
Display* display() { return x_display_->display(); }
// Returns window title for the specified X |window|.
// Returns window title for the specified X `window`.
bool GetWindowTitle(::Window window, std::string* title);
Callback* callback_ = nullptr;

View file

@ -40,7 +40,7 @@ DeferXFree::~DeferXFree() {
XFree(data_);
}
// Iterates through |window| hierarchy to find first visible window, i.e. one
// Iterates through `window` hierarchy to find first visible window, i.e. one
// that has WM_STATE property set to NormalState.
// See http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.3.1 .
::Window GetApplicationWindow(XAtomCache* cache, ::Window window) {
@ -76,7 +76,7 @@ DeferXFree::~DeferXFree() {
return app_window;
}
// Returns true if the |window| is a desktop element.
// Returns true if the `window` is a desktop element.
bool IsDesktopElement(XAtomCache* cache, ::Window window) {
RTC_DCHECK(cache);
if (window == 0)

View file

@ -21,30 +21,30 @@
namespace webrtc {
// Synchronously iterates all on-screen windows in |cache|.display() in
// decreasing z-order and sends them one-by-one to |on_window| function before
// GetWindowList() returns. If |on_window| returns false, this function ignores
// Synchronously iterates all on-screen windows in `cache`.display() in
// decreasing z-order and sends them one-by-one to `on_window` function before
// GetWindowList() returns. If `on_window` returns false, this function ignores
// other windows and returns immediately. GetWindowList() returns false if
// native APIs failed. If multiple screens are attached to the |display|, this
// native APIs failed. If multiple screens are attached to the `display`, this
// function returns false only when native APIs failed on all screens. Menus,
// panels and minimized windows will be ignored.
bool GetWindowList(XAtomCache* cache,
rtc::FunctionView<bool(::Window)> on_window);
// Returns WM_STATE property of the |window|. This function returns
// WithdrawnState if the |window| is missing.
// Returns WM_STATE property of the `window`. This function returns
// WithdrawnState if the `window` is missing.
int32_t GetWindowState(XAtomCache* cache, ::Window window);
// Returns the rectangle of the |window| in the coordinates of |display|. This
// function returns false if native APIs failed. If |attributes| is provided, it
// will be filled with the attributes of |window|. The |rect| is in system
// Returns the rectangle of the `window` in the coordinates of `display`. This
// function returns false if native APIs failed. If `attributes` is provided, it
// will be filled with the attributes of `window`. The `rect` is in system
// coordinate, i.e. the primary monitor always starts from (0, 0).
bool GetWindowRect(::Display* display,
::Window window,
DesktopRect* rect,
XWindowAttributes* attributes = nullptr);
// Creates a DesktopRect from |attributes|.
// Creates a DesktopRect from `attributes`.
template <typename T>
DesktopRect DesktopRectFromXAttributes(const T& attributes) {
return DesktopRect::MakeXYWH(attributes.x, attributes.y, attributes.width,

View file

@ -27,9 +27,9 @@ namespace webrtc {
namespace {
// Returns the number of bits |mask| has to be shifted left so its last
// Returns the number of bits `mask` has to be shifted left so its last
// (most-significant) bit set becomes the most-significant bit of the word.
// When |mask| is 0 the function returns 31.
// When `mask` is 0 the function returns 31.
uint32_t MaskToShift(uint32_t mask) {
int shift = 0;
if ((mask & 0xffff0000u) == 0) {
@ -54,7 +54,7 @@ uint32_t MaskToShift(uint32_t mask) {
return shift;
}
// Returns true if |image| is in RGB format.
// Returns true if `image` is in RGB format.
bool IsXImageRGBFormat(XImage* image) {
return image->bits_per_pixel == 32 && image->red_mask == 0xff0000 &&
image->green_mask == 0xff00 && image->blue_mask == 0xff;
@ -191,7 +191,7 @@ bool XServerPixelBuffer::Init(XAtomCache* cache, Window window) {
}
if (cache->IccProfile() != None) {
// |window| is the root window when doing screen capture.
// `window` is the root window when doing screen capture.
XWindowProperty<uint8_t> icc_profile_property(cache->display(), window,
cache->IccProfile());
if (icc_profile_property.is_valid() && icc_profile_property.size() > 0) {
@ -283,7 +283,7 @@ bool XServerPixelBuffer::InitPixmaps(int depth) {
window_rect_.width(), window_rect_.height(), depth);
XSync(display_, False);
if (error_trap.GetLastErrorAndDisable() != 0) {
// |shm_pixmap_| is not not valid because the request was not processed
// `shm_pixmap_` is not not valid because the request was not processed
// by the X Server, so zero it.
shm_pixmap_ = 0;
return false;

View file

@ -36,7 +36,7 @@ class XServerPixelBuffer {
void Release();
// Allocate (or reallocate) the pixel buffer for |window|. Returns false in
// Allocate (or reallocate) the pixel buffer for `window`. Returns false in
// case of an error (e.g. window doesn't exist).
bool Init(XAtomCache* cache, Window window);
@ -58,10 +58,10 @@ class XServerPixelBuffer {
// beginning.
void Synchronize();
// Capture the specified rectangle and stores it in the |frame|. In the case
// Capture the specified rectangle and stores it in the `frame`. In the case
// where the full-screen data is captured by Synchronize(), this simply
// returns the pointer without doing any more work. The caller must ensure
// that |rect| is not larger than window_size().
// that `rect` is not larger than window_size().
bool CaptureRect(const DesktopRect& rect, DesktopFrame* frame);
private:

View file

@ -71,7 +71,7 @@ struct RTC_EXPORT MacDesktopConfiguration {
// Returns true if the given desktop configuration equals this one.
bool Equals(const MacDesktopConfiguration& other);
// If |id| corresponds to the built-in display, return its configuration,
// If `id` corresponds to the built-in display, return its configuration,
// otherwise return the configuration for the display with the specified id,
// or nullptr if no such display exists.
const MacDisplayConfiguration* FindDisplayConfigurationById(

View file

@ -38,8 +38,8 @@ DesktopRect NSRectToDesktopRect(const NSRect& ns_rect) {
static_cast<int>(ceil(ns_rect.origin.y + ns_rect.size.height)));
}
// Inverts the position of |rect| from bottom-up coordinates to top-down,
// relative to |bounds|.
// Inverts the position of `rect` from bottom-up coordinates to top-down,
// relative to `bounds`.
void InvertRectYOrigin(const DesktopRect& bounds,
DesktopRect* rect) {
RTC_DCHECK_EQ(bounds.top(), 0);
@ -125,7 +125,7 @@ MacDesktopConfiguration MacDesktopConfiguration::GetCurrent(Origin origin) {
if (i > 0 && origin == TopLeftOrigin) {
InvertRectYOrigin(desktop_config.displays[0].bounds,
&display_config.bounds);
// |display_bounds| is density dependent, so we need to convert the
// `display_bounds` is density dependent, so we need to convert the
// primay monitor's position into the secondary monitor's density context.
float scaling_factor = display_config.dip_to_pixel_scale /
desktop_config.displays[0].dip_to_pixel_scale;

View file

@ -39,7 +39,7 @@ class DesktopFrameCGImage final : public DesktopFrame {
static std::unique_ptr<DesktopFrameCGImage> CreateFromCGImage(
rtc::ScopedCFTypeRef<CGImageRef> cg_image);
// This constructor expects |cg_image| to hold a non-null CGImageRef.
// This constructor expects `cg_image` to hold a non-null CGImageRef.
DesktopFrameCGImage(DesktopSize size,
int stride,
uint8_t* data,

View file

@ -31,7 +31,7 @@ class DesktopFrameIOSurface final : public DesktopFrame {
~DesktopFrameIOSurface() override;
private:
// This constructor expects |io_surface| to hold a non-null IOSurfaceRef.
// This constructor expects `io_surface` to hold a non-null IOSurfaceRef.
explicit DesktopFrameIOSurface(rtc::ScopedCFTypeRef<IOSurfaceRef> io_surface);
const rtc::ScopedCFTypeRef<IOSurfaceRef> io_surface_;

View file

@ -29,7 +29,7 @@ class DesktopFrameProvider {
~DesktopFrameProvider();
// The caller takes ownership of the returned desktop frame. Otherwise
// returns null if |display_id| is invalid or not ready. Note that this
// returns null if `display_id` is invalid or not ready. Note that this
// function does not remove the frame from the internal container. Caller
// has to call the Release function.
std::unique_ptr<DesktopFrame> TakeLatestFrameForDisplay(

View file

@ -33,8 +33,8 @@ DesktopRect ScaleAndRoundCGRect(const CGRect& rect, float scale) {
static_cast<int>(ceil((rect.origin.y + rect.size.height) * scale)));
}
// Copy pixels in the |rect| from |src_place| to |dest_plane|. |rect| should be
// relative to the origin of |src_plane| and |dest_plane|.
// Copy pixels in the `rect` from `src_place` to `dest_plane`. `rect` should be
// relative to the origin of `src_plane` and `dest_plane`.
void CopyRect(const uint8_t* src_plane,
int src_plane_stride,
uint8_t* dest_plane,
@ -59,7 +59,7 @@ void CopyRect(const uint8_t* src_plane,
}
// Returns an array of CGWindowID for all the on-screen windows except
// |window_to_exclude|, or NULL if the window is not found or it fails. The
// `window_to_exclude`, or NULL if the window is not found or it fails. The
// caller should release the returned CFArrayRef.
CFArrayRef CreateWindowListWithExclusion(CGWindowID window_to_exclude) {
if (!window_to_exclude) return nullptr;
@ -92,7 +92,7 @@ CFArrayRef CreateWindowListWithExclusion(CGWindowID window_to_exclude) {
return returned_array;
}
// Returns the bounds of |window| in physical pixels, enlarged by a small amount
// Returns the bounds of `window` in physical pixels, enlarged by a small amount
// on four edges to take account of the border/shadow effects.
DesktopRect GetExcludedWindowPixelBounds(CGWindowID window, float dip_to_pixel_scale) {
// The amount of pixels to add to the actual window bounds to take into
@ -121,12 +121,12 @@ DesktopRect GetExcludedWindowPixelBounds(CGWindowID window, float dip_to_pixel_s
rect.origin.y -= kBorderEffectSize;
rect.size.width += kBorderEffectSize * 2;
rect.size.height += kBorderEffectSize * 2;
// |rect| is in DIP, so convert to physical pixels.
// `rect` is in DIP, so convert to physical pixels.
return ScaleAndRoundCGRect(rect, dip_to_pixel_scale);
}
// Create an image of the given region using the given |window_list|.
// |pixel_bounds| should be in the primary display's coordinate in physical
// Create an image of the given region using the given `window_list`.
// `pixel_bounds` should be in the primary display's coordinate in physical
// pixels.
rtc::ScopedCFTypeRef<CGImageRef> CreateExcludedWindowRegionImage(const DesktopRect& pixel_bounds,
float dip_to_pixel_scale,
@ -366,7 +366,7 @@ bool ScreenCapturerMac::CgBlit(const DesktopFrame& frame, const DesktopRegion& r
int src_bytes_per_row = frame_source->stride();
RTC_DCHECK(display_base_address);
// |frame_source| size may be different from display_bounds in case the screen was
// `frame_source` size may be different from display_bounds in case the screen was
// resized recently.
copy_region.IntersectWith(frame_source->rect());
@ -388,7 +388,7 @@ bool ScreenCapturerMac::CgBlit(const DesktopFrame& frame, const DesktopRegion& r
display_base_address = CFDataGetBytePtr(excluded_image_data.get());
src_bytes_per_row = CGImageGetBytesPerRow(excluded_image.get());
// Translate the bounds relative to the desktop, because |frame| data
// Translate the bounds relative to the desktop, because `frame` data
// starts from the desktop top-left corner.
DesktopRect window_bounds_relative_to_desktop(excluded_window_bounds);
window_bounds_relative_to_desktop.Translate(-screen_pixel_bounds_.left(),

View file

@ -44,15 +44,15 @@ bool ToUtf8(const CFStringRef str16, std::string* str8) {
return true;
}
// Get CFDictionaryRef from |id| and call |on_window| against it. This function
// returns false if native APIs fail, typically it indicates that the |id| does
// not represent a window. |on_window| will not be called if false is returned
// Get CFDictionaryRef from `id` and call `on_window` against it. This function
// returns false if native APIs fail, typically it indicates that the `id` does
// not represent a window. `on_window` will not be called if false is returned
// from this function.
bool GetWindowRef(CGWindowID id,
rtc::FunctionView<void(CFDictionaryRef)> on_window) {
RTC_DCHECK(on_window);
// TODO(zijiehe): |id| is a 32-bit integer, casting it to an array seems not
// TODO(zijiehe): `id` is a 32-bit integer, casting it to an array seems not
// safe enough. Maybe we should create a new
// const void* arr[] = {
// reinterpret_cast<void*>(id) }

View file

@ -23,10 +23,10 @@
namespace webrtc {
// Iterates all on-screen windows in decreasing z-order and sends them
// one-by-one to |on_window| function. If |on_window| returns false, this
// one-by-one to `on_window` function. If `on_window` returns false, this
// function returns immediately. GetWindowList() returns false if native APIs
// failed. Menus, dock (if |only_zero_layer|), minimized windows (if
// |ignore_minimized| is true) and any windows which do not have a valid window
// failed. Menus, dock (if `only_zero_layer`), minimized windows (if
// `ignore_minimized` is true) and any windows which do not have a valid window
// id or title will be ignored.
bool GetWindowList(rtc::FunctionView<bool(CFDictionaryRef)> on_window,
bool ignore_minimized,
@ -45,59 +45,59 @@ bool IsWindowFullScreen(const MacDesktopConfiguration& desktop_config,
bool IsWindowFullScreen(const MacDesktopConfiguration& desktop_config,
CGWindowID id);
// Returns true if the |window| is on screen. This function returns false if
// Returns true if the `window` is on screen. This function returns false if
// native APIs fail.
bool IsWindowOnScreen(CFDictionaryRef window);
// Returns true if the window is on screen. This function returns false if
// native APIs fail or |id| cannot be found.
// native APIs fail or `id` cannot be found.
bool IsWindowOnScreen(CGWindowID id);
// Returns utf-8 encoded title of |window|. If |window| is not a window or no
// Returns utf-8 encoded title of `window`. If `window` is not a window or no
// valid title can be retrieved, this function returns an empty string.
std::string GetWindowTitle(CFDictionaryRef window);
// Returns utf-8 encoded title of window |id|. If |id| cannot be found or no
// Returns utf-8 encoded title of window `id`. If `id` cannot be found or no
// valid title can be retrieved, this function returns an empty string.
std::string GetWindowTitle(CGWindowID id);
// Returns utf-8 encoded owner name of |window|. If |window| is not a window or
// Returns utf-8 encoded owner name of `window`. If `window` is not a window or
// if no valid owner name can be retrieved, returns an empty string.
std::string GetWindowOwnerName(CFDictionaryRef window);
// Returns utf-8 encoded owner name of the given window |id|. If |id| cannot be
// Returns utf-8 encoded owner name of the given window `id`. If `id` cannot be
// found or if no valid owner name can be retrieved, returns an empty string.
std::string GetWindowOwnerName(CGWindowID id);
// Returns id of |window|. If |window| is not a window or the window id cannot
// Returns id of `window`. If `window` is not a window or the window id cannot
// be retrieved, this function returns kNullWindowId.
WindowId GetWindowId(CFDictionaryRef window);
// Returns the pid of the process owning |window|. Return 0 if |window| is not
// Returns the pid of the process owning `window`. Return 0 if `window` is not
// a window or no valid owner can be retrieved.
int GetWindowOwnerPid(CFDictionaryRef window);
// Returns the pid of the process owning the window |id|. Return 0 if |id|
// Returns the pid of the process owning the window `id`. Return 0 if `id`
// cannot be found or no valid owner can be retrieved.
int GetWindowOwnerPid(CGWindowID id);
// Returns the DIP to physical pixel scale at |position|. |position| is in
// Returns the DIP to physical pixel scale at `position`. `position` is in
// *unscaled* system coordinate, i.e. it's device-independent and the primary
// monitor starts from (0, 0). If |position| is out of the system display, this
// monitor starts from (0, 0). If `position` is out of the system display, this
// function returns 1.
float GetScaleFactorAtPosition(const MacDesktopConfiguration& desktop_config,
DesktopVector position);
// Returns the DIP to physical pixel scale factor of the window with |id|.
// The bounds of the window with |id| is in DIP coordinates and |size| is the
// CGImage size of the window with |id| in physical coordinates. Comparing them
// Returns the DIP to physical pixel scale factor of the window with `id`.
// The bounds of the window with `id` is in DIP coordinates and `size` is the
// CGImage size of the window with `id` in physical coordinates. Comparing them
// can give the current scale factor.
// If the window overlaps multiple monitors, OS will decide on which monitor the
// window is displayed and use its scale factor to the window. So this method
// still works.
float GetWindowScaleFactor(CGWindowID id, DesktopSize size);
// Returns the bounds of |window|. If |window| is not a window or the bounds
// Returns the bounds of `window`. If `window` is not a window or the bounds
// cannot be retrieved, this function returns an empty DesktopRect. The returned
// DesktopRect is in system coordinate, i.e. the primary monitor always starts
// from (0, 0).
@ -105,7 +105,7 @@ float GetWindowScaleFactor(CGWindowID id, DesktopSize size);
// MacDesktopConfiguration.
DesktopRect GetWindowBounds(CFDictionaryRef window);
// Returns the bounds of window with |id|. If |id| does not represent a window
// Returns the bounds of window with `id`. If `id` does not represent a window
// or the bounds cannot be retrieved, this function returns an empty
// DesktopRect. The returned DesktopRect is in system coordinates.
// Deprecated: This function should be avoided in favor of the overload with

View file

@ -24,7 +24,7 @@ class RTC_EXPORT MouseCursor {
public:
MouseCursor();
// Takes ownership of |image|. |hotspot| must be within |image| boundaries.
// Takes ownership of `image`. `hotspot` must be within `image` boundaries.
MouseCursor(DesktopFrame* image, const DesktopVector& hotspot);
~MouseCursor();

View file

@ -47,16 +47,16 @@ class MouseCursorMonitor {
class Callback {
public:
// Called in response to Capture() when the cursor shape has changed. Must
// take ownership of |cursor|.
// take ownership of `cursor`.
virtual void OnMouseCursor(MouseCursor* cursor) = 0;
// Called in response to Capture(). |position| indicates cursor position
// relative to the |window| specified in the constructor.
// Called in response to Capture(). `position` indicates cursor position
// relative to the `window` specified in the constructor.
// Deprecated: use the following overload instead.
virtual void OnMouseCursorPosition(CursorState state,
const DesktopVector& position) {}
// Called in response to Capture(). |position| indicates cursor absolute
// Called in response to Capture(). `position` indicates cursor absolute
// position on the system in fullscreen coordinate, i.e. the top-left
// monitor always starts from (0, 0).
// The coordinates of the position is controlled by OS, but it's always
@ -94,11 +94,11 @@ class MouseCursorMonitor {
static std::unique_ptr<MouseCursorMonitor> Create(
const DesktopCaptureOptions& options);
// Initializes the monitor with the |callback|, which must remain valid until
// Initializes the monitor with the `callback`, which must remain valid until
// capturer is destroyed.
virtual void Init(Callback* callback, Mode mode) = 0;
// Captures current cursor shape and position (depending on the |mode| passed
// Captures current cursor shape and position (depending on the `mode` passed
// to Init()). Calls Callback::OnMouseCursor() if cursor shape has
// changed since the last call (or when Capture() is called for the first
// time) and then Callback::OnMouseCursorPosition() if mode is set to

View file

@ -17,8 +17,8 @@ namespace webrtc {
class ResolutionTracker final {
public:
// Sets the resolution to |size|. Returns true if a previous size was recorded
// and differs from |size|.
// Sets the resolution to `size`. Returns true if a previous size was recorded
// and differs from `size`.
bool SetResolution(DesktopSize size);
// Resets to the initial state.

View file

@ -37,10 +37,10 @@ struct RgbaColor final {
// instance from the ToUInt32() result of another RgbaColor instance.
explicit RgbaColor(uint32_t bgra);
// Returns true if |this| and |right| is the same color.
// Returns true if `this` and `right` is the same color.
bool operator==(const RgbaColor& right) const;
// Returns true if |this| and |right| are different colors.
// Returns true if `this` and `right` are different colors.
bool operator!=(const RgbaColor& right) const;
uint32_t ToUInt32() const;

View file

@ -45,7 +45,7 @@ class ScreenCaptureFrameQueue {
void MoveToNextFrame() { current_ = (current_ + 1) % kQueueLength; }
// Replaces the current frame with a new one allocated by the caller. The
// existing frame (if any) is destroyed. Takes ownership of |frame|.
// existing frame (if any) is destroyed. Takes ownership of `frame`.
void ReplaceCurrentFrame(std::unique_ptr<FrameType> frame) {
frames_[current_] = std::move(frame);
}

View file

@ -58,14 +58,14 @@ void ScreenCapturerHelper::set_size_most_recent(const DesktopSize& size) {
size_most_recent_ = size;
}
// Returns the largest multiple of |n| that is <= |x|.
// |n| must be a power of 2. |nMask| is ~(|n| - 1).
// Returns the largest multiple of `n` that is <= `x`.
// `n` must be a power of 2. `nMask` is ~(`n` - 1).
static int DownToMultiple(int x, int nMask) {
return (x & nMask);
}
// Returns the smallest multiple of |n| that is >= |x|.
// |n| must be a power of 2. |nMask| is ~(|n| - 1).
// Returns the smallest multiple of `n` that is >= `x`.
// `n` must be a power of 2. `nMask` is ~(`n` - 1).
static int UpToMultiple(int x, int n, int nMask) {
return ((x + n - 1) & nMask);
}

View file

@ -39,7 +39,7 @@ class ScreenCapturerHelper {
// Invalidate the entire screen, of a given size.
void InvalidateScreen(const DesktopSize& size);
// Copies current invalid region to |invalid_region| clears invalid region
// Copies current invalid region to `invalid_region` clears invalid region
// storage for the next frame.
void TakeInvalidRegion(DesktopRegion* invalid_region);
@ -52,16 +52,16 @@ class ScreenCapturerHelper {
// be changed in the compressed output. So we need to re-render an entire
// block whenever part of the block changes.
//
// If |log_grid_size| is >= 1, then this function makes TakeInvalidRegion()
// If `log_grid_size` is >= 1, then this function makes TakeInvalidRegion()
// produce an invalid region expanded so that its vertices lie on a grid of
// size 2 ^ |log_grid_size|. The expanded region is then clipped to the size
// size 2 ^ `log_grid_size`. The expanded region is then clipped to the size
// of the most recently captured screen, as previously set by
// set_size_most_recent().
// If |log_grid_size| is <= 0, then the invalid region is not expanded.
// If `log_grid_size` is <= 0, then the invalid region is not expanded.
void SetLogGridSize(int log_grid_size);
// Expands a region so that its vertices all lie on a grid.
// The grid size must be >= 2, so |log_grid_size| must be >= 1.
// The grid size must be >= 2, so `log_grid_size` must be >= 1.
static void ExpandToGrid(const DesktopRegion& region,
int log_grid_size,
DesktopRegion* result);
@ -72,7 +72,7 @@ class ScreenCapturerHelper {
// capture.
DesktopRegion invalid_region_ RTC_GUARDED_BY(invalid_region_mutex_);
// A lock protecting |invalid_region_| across threads.
// A lock protecting `invalid_region_` across threads.
Mutex invalid_region_mutex_;
// The size of the most recently captured screen.

View file

@ -47,7 +47,7 @@ ACTION_P2(SaveCaptureResult, result, dest) {
*dest = std::move(*arg1);
}
// Returns true if color in |rect| of |frame| is |color|.
// Returns true if color in `rect` of `frame` is `color`.
bool ArePixelsColoredBy(const DesktopFrame& frame,
DesktopRect rect,
RgbaColor color,
@ -61,7 +61,7 @@ bool ArePixelsColoredBy(const DesktopFrame& frame,
}
}
// Color in the |rect| should be |color|.
// Color in the `rect` should be `color`.
uint8_t* row = frame.GetFrameDataAtPos(rect.top_left());
for (int i = 0; i < rect.height(); i++) {
uint8_t* column = row;
@ -118,9 +118,9 @@ class ScreenCapturerIntegrationTest : public ::testing::Test {
capturer->Start(&callback_);
}
// Draw a set of |kRectSize| by |kRectSize| rectangles at (|i|, |i|), or
// |i| by |i| rectangles at (|kRectSize|, |kRectSize|). One of (controlled
// by |c|) its primary colors is |i|, and the other two are 0x7f. So we
// Draw a set of `kRectSize` by `kRectSize` rectangles at (`i`, `i`), or
// `i` by `i` rectangles at (`kRectSize`, `kRectSize`). One of (controlled
// by `c`) its primary colors is `i`, and the other two are 0x7f. So we
// won't draw a black or white rectangle.
for (int c = 0; c < 3; c++) {
// A fixed size rectangle.
@ -184,9 +184,9 @@ class ScreenCapturerIntegrationTest : public ::testing::Test {
MockDesktopCapturerCallback callback_;
private:
// Repeats capturing the frame by using |capturers| one-by-one for 600 times,
// typically 30 seconds, until they succeeded captured a |color| rectangle at
// |rect|. This function uses |drawer|->WaitForPendingDraws() between two
// Repeats capturing the frame by using `capturers` one-by-one for 600 times,
// typically 30 seconds, until they succeeded captured a `color` rectangle at
// `rect`. This function uses `drawer`->WaitForPendingDraws() between two
// attempts to wait for the screen to update.
void TestCaptureOneFrame(std::vector<DesktopCapturer*> capturers,
ScreenDrawer* drawer,
@ -262,7 +262,7 @@ class ScreenCapturerIntegrationTest : public ::testing::Test {
ASSERT_EQ(succeeded_capturers, capturers.size());
}
// Expects |capturer| to successfully capture a frame, and returns it.
// Expects `capturer` to successfully capture a frame, and returns it.
std::unique_ptr<DesktopFrame> CaptureFrame(DesktopCapturer* capturer) {
for (int i = 0; i < 10; i++) {
std::unique_ptr<DesktopFrame> frame;

View file

@ -38,7 +38,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer(
const DesktopCaptureOptions& options) {
std::unique_ptr<DesktopCapturer> capturer(new ScreenCapturerWinGdi(options));
if (options.allow_directx_capturer()) {
// |dxgi_duplicator_controller| should be alive in this scope to ensure it
// `dxgi_duplicator_controller` should be alive in this scope to ensure it
// won't unload DxgiDuplicatorController.
auto dxgi_duplicator_controller = DxgiDuplicatorController::Instance();
if (ScreenCapturerWinDirectx::IsSupported()) {

View file

@ -50,8 +50,8 @@ class ScreenDrawer {
// system coordinate, i.e. the primary monitor always starts from (0, 0).
virtual DesktopRect DrawableRegion() = 0;
// Draws a rectangle to cover |rect| with |color|. Note, rect.bottom() and
// rect.right() two lines are not included. The part of |rect| which is out of
// Draws a rectangle to cover `rect` with `color`. Note, rect.bottom() and
// rect.right() two lines are not included. The part of `rect` which is out of
// DrawableRegion() will be ignored.
virtual void DrawRectangle(DesktopRect rect, RgbaColor color) = 0;

View file

@ -64,7 +64,7 @@ void TestScreenDrawerLock(
// SleepMs() may return early. See
// https://cs.chromium.org/chromium/src/third_party/webrtc/system_wrappers/include/sleep.h?rcl=4a604c80cecce18aff6fc5e16296d04675312d83&l=20
// But we need to ensure at least 100 ms has been passed before unlocking
// |lock|.
// `lock`.
while (rtc::TimeMillis() - current_ms < kLockDurationMs) {
SleepMs(kLockDurationMs - (rtc::TimeMillis() - current_ms));
}

View file

@ -89,10 +89,10 @@ class ScreenDrawerWin : public ScreenDrawer {
// windows or shadow effects.
void BringToFront();
// Draw a line with |color|.
// Draw a line with `color`.
void DrawLine(DesktopVector start, DesktopVector end, RgbaColor color);
// Draw a dot with |color|.
// Draw a dot with `color`.
void DrawDot(DesktopVector vect, RgbaColor color);
const DesktopRect rect_;
@ -105,7 +105,7 @@ ScreenDrawerWin::ScreenDrawerWin()
rect_(GetScreenRect()),
window_(CreateDrawerWindow(rect_)),
hdc_(GetWindowDC(window_)) {
// We do not need to handle any messages for the |window_|, so disable Windows
// We do not need to handle any messages for the `window_`, so disable Windows
// from processing windows ghosting feature.
DisableProcessWindowsGhosting();

View file

@ -40,7 +40,7 @@ class RTC_EXPORT SharedDesktopFrame final : public DesktopFrame {
// Returns the underlying instance of DesktopFrame.
DesktopFrame* GetUnderlyingFrame();
// Returns whether |this| and |other| share the underlying DesktopFrame.
// Returns whether `this` and `other` share the underlying DesktopFrame.
bool ShareFrameWith(const SharedDesktopFrame& other) const;
// Creates a clone of this object.

View file

@ -15,10 +15,10 @@
namespace webrtc {
// Clears a DesktopFrame |frame| by setting its data() into 0.
// Clears a DesktopFrame `frame` by setting its data() into 0.
void ClearDesktopFrame(DesktopFrame* frame);
// Compares size() and data() of two DesktopFrames |left| and |right|.
// Compares size() and data() of two DesktopFrames `left` and `right`.
bool DesktopFrameDataEquals(const DesktopFrame& left,
const DesktopFrame& right);

View file

@ -88,7 +88,7 @@ void AlphaMul(uint32_t* data, int width, int height) {
}
// Scans a 32bpp bitmap looking for any pixels with non-zero alpha component.
// Returns true if non-zero alpha is found. |stride| is expressed in pixels.
// Returns true if non-zero alpha is found. `stride` is expressed in pixels.
bool HasAlphaChannel(const uint32_t* data, int stride, int width, int height) {
const RGBQUAD* plane = reinterpret_cast<const RGBQUAD*>(data);
for (int y = 0; y < height; ++y) {
@ -121,7 +121,7 @@ MouseCursor* CreateMouseCursorFromHCursor(HDC dc, HCURSOR cursor) {
win::ScopedBitmap scoped_color(iinfo.hbmColor);
bool is_color = iinfo.hbmColor != NULL;
// Get |scoped_mask| dimensions.
// Get `scoped_mask` dimensions.
BITMAP bitmap_info;
if (!GetObject(scoped_mask, sizeof(bitmap_info), &bitmap_info)) {
RTC_LOG_F(LS_ERROR) << "Unable to get bitmap info. Error = "
@ -133,7 +133,7 @@ MouseCursor* CreateMouseCursorFromHCursor(HDC dc, HCURSOR cursor) {
int height = bitmap_info.bmHeight;
std::unique_ptr<uint32_t[]> mask_data(new uint32_t[width * height]);
// Get pixel data from |scoped_mask| converting it to 32bpp along the way.
// Get pixel data from `scoped_mask` converting it to 32bpp along the way.
// GetDIBits() sets the alpha component of every pixel to 0.
BITMAPV5HEADER bmi = {0};
bmi.bV5Size = sizeof(bmi);

View file

@ -17,7 +17,7 @@ namespace webrtc {
class MouseCursor;
// Converts an HCURSOR into a |MouseCursor| instance.
// Converts an HCURSOR into a `MouseCursor` instance.
MouseCursor* CreateMouseCursorFromHCursor(HDC dc, HCURSOR cursor);
} // namespace webrtc

View file

@ -23,18 +23,18 @@ namespace webrtc {
namespace {
// Loads |left| from resources, converts it to a |MouseCursor| instance and
// compares pixels with |right|. Returns true of MouseCursor bits match |right|.
// |right| must be a 32bpp cursor with alpha channel.
// Loads `left` from resources, converts it to a `MouseCursor` instance and
// compares pixels with `right`. Returns true of MouseCursor bits match `right`.
// `right` must be a 32bpp cursor with alpha channel.
bool ConvertToMouseShapeAndCompare(unsigned left, unsigned right) {
HMODULE instance = GetModuleHandle(NULL);
// Load |left| from the EXE module's resources.
// Load `left` from the EXE module's resources.
win::ScopedCursor cursor(reinterpret_cast<HCURSOR>(
LoadImage(instance, MAKEINTRESOURCE(left), IMAGE_CURSOR, 0, 0, 0)));
EXPECT_TRUE(cursor != NULL);
// Convert |cursor| to |mouse_shape|.
// Convert `cursor` to `mouse_shape`.
HDC dc = GetDC(NULL);
std::unique_ptr<MouseCursor> mouse_shape(
CreateMouseCursorFromHCursor(dc, cursor));
@ -42,7 +42,7 @@ bool ConvertToMouseShapeAndCompare(unsigned left, unsigned right) {
EXPECT_TRUE(mouse_shape.get());
// Load |right|.
// Load `right`.
cursor.Set(reinterpret_cast<HCURSOR>(
LoadImage(instance, MAKEINTRESOURCE(right), IMAGE_CURSOR, 0, 0, 0)));
@ -54,7 +54,7 @@ bool ConvertToMouseShapeAndCompare(unsigned left, unsigned right) {
win::ScopedBitmap scoped_mask(iinfo.hbmMask);
win::ScopedBitmap scoped_color(iinfo.hbmColor);
// Get |scoped_color| dimensions.
// Get `scoped_color` dimensions.
BITMAP bitmap_info;
EXPECT_TRUE(GetObject(scoped_color, sizeof(bitmap_info), &bitmap_info));
@ -62,12 +62,12 @@ bool ConvertToMouseShapeAndCompare(unsigned left, unsigned right) {
int height = bitmap_info.bmHeight;
EXPECT_TRUE(DesktopSize(width, height).equals(mouse_shape->image()->size()));
// Get the pixels from |scoped_color|.
// Get the pixels from `scoped_color`.
int size = width * height;
std::unique_ptr<uint32_t[]> data(new uint32_t[size]);
EXPECT_TRUE(GetBitmapBits(scoped_color, size * sizeof(uint32_t), data.get()));
// Compare the 32bpp image in |mouse_shape| with the one loaded from |right|.
// Compare the 32bpp image in `mouse_shape` with the one loaded from `right`.
return memcmp(data.get(), mouse_shape->image()->data(),
size * sizeof(uint32_t)) == 0;
}

View file

@ -28,7 +28,7 @@ class RTC_EXPORT Desktop {
// quering the name failed for any reason.
bool GetName(std::wstring* desktop_name_out) const;
// Returns true if |other| has the same name as this desktop. Returns false
// Returns true if `other` has the same name as this desktop. Returns false
// in any other case including failing Win32 APIs and uninitialized desktop
// handles.
bool IsSame(const Desktop& other) const;
@ -54,7 +54,7 @@ class RTC_EXPORT Desktop {
// The desktop handle.
HDESK desktop_;
// True if |desktop_| must be closed on teardown.
// True if `desktop_` must be closed on teardown.
bool own_;
RTC_DISALLOW_COPY_AND_ASSIGN(Desktop);

View file

@ -43,10 +43,10 @@ class DxgiAdapterDuplicator {
bool Initialize();
// Sequentially calls Duplicate function of all the DxgiOutputDuplicator
// instances owned by this instance, and writes into |target|.
// instances owned by this instance, and writes into `target`.
bool Duplicate(Context* context, SharedDesktopFrame* target);
// Captures one monitor and writes into |target|. |monitor_id| should be
// Captures one monitor and writes into `target`. `monitor_id` should be
// between [0, screen_count()).
bool DuplicateMonitor(Context* context,
int monitor_id,
@ -55,12 +55,12 @@ class DxgiAdapterDuplicator {
// Returns desktop rect covered by this DxgiAdapterDuplicator.
DesktopRect desktop_rect() const { return desktop_rect_; }
// Returns the size of one screen owned by this DxgiAdapterDuplicator. |id|
// Returns the size of one screen owned by this DxgiAdapterDuplicator. `id`
// should be between [0, screen_count()).
DesktopRect ScreenRect(int id) const;
// Returns the device name of one screen owned by this DxgiAdapterDuplicator
// in utf8 encoding. |id| should be between [0, screen_count()).
// in utf8 encoding. `id` should be between [0, screen_count()).
const std::string& GetDeviceName(int id) const;
// Returns the count of screens owned by this DxgiAdapterDuplicator. These
@ -72,10 +72,10 @@ class DxgiAdapterDuplicator {
void Unregister(const Context* const context);
// The minimum num_frames_captured() returned by |duplicators_|.
// The minimum num_frames_captured() returned by `duplicators_`.
int64_t GetNumFramesCaptured() const;
// Moves |desktop_rect_| and all underlying |duplicators_|. See
// Moves `desktop_rect_` and all underlying `duplicators_`. See
// DxgiDuplicatorController::TranslateRect().
void TranslateRect(const DesktopVector& position);

View file

@ -48,7 +48,7 @@ struct DxgiFrameContext final {
// Reset current Context, so it will be reinitialized next time.
void Reset();
// A Context will have an exactly same |controller_id| as
// A Context will have an exactly same `controller_id` as
// DxgiDuplicatorController, to ensure it has been correctly setted up after
// each DxgiDuplicatorController::Initialize().
int controller_id = 0;

View file

@ -186,12 +186,12 @@ DxgiDuplicatorController::Result DxgiDuplicatorController::DoDuplicate(
return Result::SUCCEEDED;
}
if (monitor_id >= ScreenCountUnlocked()) {
// It's a user error to provide a |monitor_id| larger than screen count. We
// It's a user error to provide a `monitor_id` larger than screen count. We
// do not need to deinitialize.
return Result::INVALID_MONITOR_ID;
}
// If the |monitor_id| is valid, but DoDuplicateUnlocked() failed, something
// If the `monitor_id` is valid, but DoDuplicateUnlocked() failed, something
// must be wrong from capturer APIs. We should Deinitialize().
Deinitialize();
return Result::DUPLICATION_FAILED;
@ -440,8 +440,8 @@ bool DxgiDuplicatorController::EnsureFrameCaptured(Context* context,
SharedDesktopFrame* shared_frame = nullptr;
if (target->size().width() >= desktop_size().width() &&
target->size().height() >= desktop_size().height()) {
// |target| is large enough to cover entire screen, we do not need to use
// |fallback_frame|.
// `target` is large enough to cover entire screen, we do not need to use
// `fallback_frame`.
shared_frame = target;
} else {
fallback_frame = SharedDesktopFrame::Wrap(
@ -453,7 +453,7 @@ bool DxgiDuplicatorController::EnsureFrameCaptured(Context* context,
int64_t last_frame_start_ms = 0;
while (GetNumFramesCaptured() < frames_to_skip) {
if (GetNumFramesCaptured() > 0) {
// Sleep |ms_per_frame| before capturing next frame to ensure the screen
// Sleep `ms_per_frame` before capturing next frame to ensure the screen
// has been updated by the video adapter.
webrtc::SleepMs(ms_per_frame - (rtc::TimeMillis() - last_frame_start_ms));
}

View file

@ -68,7 +68,7 @@ class DxgiDuplicatorController {
INVALID_MONITOR_ID,
};
// Converts |result| into user-friendly string representation. The return
// Converts `result` into user-friendly string representation. The return
// value should not be used to identify error types.
static std::string ResultName(Result result);
@ -84,19 +84,19 @@ class DxgiDuplicatorController {
bool IsSupported();
// Returns a copy of D3dInfo composed by last Initialize() function call. This
// function always copies the latest information into |info|. But once the
// function returns false, the information in |info| may not accurate.
// function always copies the latest information into `info`. But once the
// function returns false, the information in `info` may not accurate.
bool RetrieveD3dInfo(D3dInfo* info);
// Captures current screen and writes into |frame|.
// Captures current screen and writes into `frame`.
// TODO(zijiehe): Windows cannot guarantee the frames returned by each
// IDXGIOutputDuplication are synchronized. But we are using a totally
// different threading model than the way Windows suggested, it's hard to
// synchronize them manually. We should find a way to do it.
Result Duplicate(DxgiFrame* frame);
// Captures one monitor and writes into target. |monitor_id| should >= 0. If
// |monitor_id| is greater than the total screen count of all the Duplicators,
// Captures one monitor and writes into target. `monitor_id` should >= 0. If
// `monitor_id` is greater than the total screen count of all the Duplicators,
// this function returns false.
Result DuplicateMonitor(DxgiFrame* frame, int monitor_id);
@ -135,21 +135,21 @@ class DxgiDuplicatorController {
void AddRef();
void Release();
// Does the real duplication work. Setting |monitor_id| < 0 to capture entire
// Does the real duplication work. Setting `monitor_id` < 0 to capture entire
// screen. This function calls Initialize(). And if the duplication failed,
// this function calls Deinitialize() to ensure the Dxgi components can be
// reinitialized next time.
Result DoDuplicate(DxgiFrame* frame, int monitor_id);
// Unload all the DXGI components and releases the resources. This function
// wraps Deinitialize() with |mutex_|.
// wraps Deinitialize() with `mutex_`.
void Unload();
// Unregisters Context from this instance and all DxgiAdapterDuplicator(s)
// it owns.
void Unregister(const Context* const context);
// All functions below should be called in |mutex_| locked scope and should be
// All functions below should be called in `mutex_` locked scope and should be
// after a successful Initialize().
// If current instance has not been initialized, executes DoInitialize()
@ -187,14 +187,14 @@ class DxgiDuplicatorController {
SharedDesktopFrame* target)
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
// The minimum GetNumFramesCaptured() returned by |duplicators_|.
// The minimum GetNumFramesCaptured() returned by `duplicators_`.
int64_t GetNumFramesCaptured() const RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
// Returns a DesktopSize to cover entire |desktop_rect_|.
// Returns a DesktopSize to cover entire `desktop_rect_`.
DesktopSize desktop_size() const RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
// Returns the size of one screen. |id| should be >= 0. If system does not
// support DXGI based capturer, or |id| is greater than the total screen count
// Returns the size of one screen. `id` should be >= 0. If system does not
// support DXGI based capturer, or `id` is greater than the total screen count
// of all the Duplicators, this function returns an empty DesktopRect.
DesktopRect ScreenRect(int id) const RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
@ -203,8 +203,8 @@ class DxgiDuplicatorController {
void GetDeviceNamesUnlocked(std::vector<std::string>* output) const
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
// Returns the desktop size of the selected screen |monitor_id|. Setting
// |monitor_id| < 0 to return the entire screen size.
// Returns the desktop size of the selected screen `monitor_id`. Setting
// `monitor_id` < 0 to return the entire screen size.
DesktopSize SelectedDesktopSize(int monitor_id) const
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
@ -216,7 +216,7 @@ class DxgiDuplicatorController {
bool EnsureFrameCaptured(Context* context, SharedDesktopFrame* target)
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
// Moves |desktop_rect_| and all underlying |duplicators_|, putting top left
// Moves `desktop_rect_` and all underlying `duplicators_`, putting top left
// corner of the desktop at (0, 0). This is necessary because DXGI_OUTPUT_DESC
// may return negative coordinates. Called from DoInitialize() after all
// DxgiAdapterDuplicator and DxgiOutputDuplicator instances are initialized.

View file

@ -32,7 +32,7 @@ class DxgiFrame final {
public:
using Context = DxgiFrameContext;
// DxgiFrame does not take ownership of |factory|, consumers should ensure it
// DxgiFrame does not take ownership of `factory`, consumers should ensure it
// outlives this instance. nullptr is acceptable.
explicit DxgiFrame(SharedMemoryFactory* factory);
~DxgiFrame();

View file

@ -171,7 +171,7 @@ bool DxgiOutputDuplicator::Duplicate(Context* context,
// We need to merge updated region with the one from context, but only spread
// updated region from current frame. So keeps a copy of updated region from
// context here. The |updated_region| always starts from (0, 0).
// context here. The `updated_region` always starts from (0, 0).
DesktopRegion updated_region;
updated_region.Swap(&context->updated_region);
if (error.Error() == S_OK && frame_info.AccumulatedFrames > 0 && resource) {
@ -188,7 +188,7 @@ bool DxgiOutputDuplicator::Duplicate(Context* context,
if (rotation_ != Rotation::CLOCK_WISE_0) {
for (DesktopRegion::Iterator it(updated_region); !it.IsAtEnd();
it.Advance()) {
// The |updated_region| returned by Windows is rotated, but the |source|
// The `updated_region` returned by Windows is rotated, but the `source`
// frame is not. So we need to rotate it reversely.
const DesktopRect source_rect =
RotateRect(it.rect(), desktop_size(), ReverseRotation(rotation_));
@ -197,7 +197,7 @@ bool DxgiOutputDuplicator::Duplicate(Context* context,
} else {
for (DesktopRegion::Iterator it(updated_region); !it.IsAtEnd();
it.Advance()) {
// The DesktopRect in |target|, starts from offset.
// The DesktopRect in `target`, starts from offset.
DesktopRect dest_rect = it.rect();
dest_rect.Translate(offset);
target->CopyPixelsFrom(source, it.rect().top_left(), dest_rect);
@ -216,9 +216,9 @@ bool DxgiOutputDuplicator::Duplicate(Context* context,
// export last frame to the target.
for (DesktopRegion::Iterator it(updated_region); !it.IsAtEnd();
it.Advance()) {
// The DesktopRect in |source|, starts from last_frame_offset_.
// The DesktopRect in `source`, starts from last_frame_offset_.
DesktopRect source_rect = it.rect();
// The DesktopRect in |target|, starts from offset.
// The DesktopRect in `target`, starts from offset.
DesktopRect target_rect = source_rect;
source_rect.Translate(last_frame_offset_);
target_rect.Translate(offset);

View file

@ -54,10 +54,10 @@ class DxgiOutputDuplicator {
// Initializes duplication_ object.
bool Initialize();
// Copies the content of current IDXGIOutput to the |target|. To improve the
// Copies the content of current IDXGIOutput to the `target`. To improve the
// performance, this function copies only regions merged from
// |context|->updated_region and DetectUpdatedRegion(). The |offset| decides
// the offset in the |target| where the content should be copied to. i.e. this
// `context`->updated_region and DetectUpdatedRegion(). The `offset` decides
// the offset in the `target` where the content should be copied to. i.e. this
// function copies the content to the rectangle of (offset.x(), offset.y()) to
// (offset.x() + desktop_rect_.width(), offset.y() + desktop_rect_.height()).
// Returns false in case of a failure.
@ -78,12 +78,12 @@ class DxgiOutputDuplicator {
// How many frames have been captured by this DxigOutputDuplicator.
int64_t num_frames_captured() const;
// Moves |desktop_rect_|. See DxgiDuplicatorController::TranslateRect().
// Moves `desktop_rect_`. See DxgiDuplicatorController::TranslateRect().
void TranslateRect(const DesktopVector& position);
private:
// Calls DoDetectUpdatedRegion(). If it fails, this function sets the
// |updated_region| as entire UntranslatedDesktopRect().
// `updated_region` as entire UntranslatedDesktopRect().
void DetectUpdatedRegion(const DXGI_OUTDUPL_FRAME_INFO& frame_info,
DesktopRegion* updated_region);
@ -106,7 +106,7 @@ class DxgiOutputDuplicator {
// (0, 0).
DesktopRect GetUntranslatedDesktopRect() const;
// Spreads changes from |context| to other registered Context(s) in
// Spreads changes from `context` to other registered Context(s) in
// contexts_.
void SpreadContextChange(const Context* const context);
@ -132,7 +132,7 @@ class DxgiOutputDuplicator {
// The last full frame of this output and its offset. If on AcquireNextFrame()
// failed because of timeout, i.e. no update, we can copy content from
// |last_frame_|.
// `last_frame_`.
std::unique_ptr<SharedDesktopFrame> last_frame_;
DesktopVector last_frame_offset_;

View file

@ -26,7 +26,7 @@ class DesktopRegion;
// A texture copied or mapped from a DXGI_OUTDUPL_FRAME_INFO and IDXGIResource.
class DxgiTexture {
public:
// Creates a DxgiTexture instance, which represents the |desktop_size| area of
// Creates a DxgiTexture instance, which represents the `desktop_size` area of
// entire screen -- usually a monitor on the system.
DxgiTexture();

View file

@ -27,7 +27,7 @@ namespace webrtc {
class DxgiTextureMapping : public DxgiTexture {
public:
// Creates a DxgiTextureMapping instance. Caller must maintain the lifetime
// of input |duplication| to make sure it outlives this instance.
// of input `duplication` to make sure it outlives this instance.
explicit DxgiTextureMapping(IDXGIOutputDuplication* duplication);
~DxgiTextureMapping() override;

View file

@ -24,7 +24,7 @@
namespace webrtc {
namespace {
// Utility function to verify that |window| has class name equal to |class_name|
// Utility function to verify that `window` has class name equal to `class_name`
bool CheckWindowClassName(HWND window, const wchar_t* class_name) {
const size_t classNameLength = wcslen(class_name);
@ -69,9 +69,9 @@ std::wstring FileNameFromPath(const std::wstring& path) {
}
// Returns windows which belong to given process id
// |sources| is a full list of available windows
// |processId| is a process identifier (window owner)
// |window_to_exclude| is a window to be exluded from result
// `sources` is a full list of available windows
// `processId` is a process identifier (window owner)
// `window_to_exclude` is a window to be exluded from result
DesktopCapturer::SourceList GetProcessWindows(
const DesktopCapturer::SourceList& sources,
DWORD processId,

View file

@ -27,7 +27,7 @@ class RTC_EXPORT ScopedThreadDesktop {
ScopedThreadDesktop();
~ScopedThreadDesktop();
// Returns true if |desktop| has the same desktop name as the currently
// Returns true if `desktop` has the same desktop name as the currently
// assigned desktop (if assigned) or as the initial desktop (if not assigned).
// Returns false in any other case including failing Win32 APIs and
// uninitialized desktop handles.
@ -36,8 +36,8 @@ class RTC_EXPORT ScopedThreadDesktop {
// Reverts the calling thread to use the initial desktop.
void Revert();
// Assigns |desktop| to be the calling thread. Returns true if the thread has
// been switched to |desktop| successfully. Takes ownership of |desktop|.
// Assigns `desktop` to be the calling thread. Returns true if the thread has
// been switched to `desktop` successfully. Takes ownership of `desktop`.
bool SetThreadDesktop(Desktop* desktop);
private:

View file

@ -37,7 +37,7 @@ bool GetScreenList(DesktopCapturer::SourceList* screens,
device.cb = sizeof(device);
enum_result = EnumDisplayDevicesW(NULL, device_index, &device, 0);
// |enum_result| is 0 if we have enumerated all devices.
// `enum_result` is 0 if we have enumerated all devices.
if (!enum_result) {
break;
}
@ -57,7 +57,7 @@ bool GetScreenList(DesktopCapturer::SourceList* screens,
bool GetHmonitorFromDeviceIndex(const DesktopCapturer::SourceId device_index,
HMONITOR* hmonitor) {
// A device index of |kFullDesktopScreenId| or -1 represents all screens, an
// A device index of `kFullDesktopScreenId` or -1 represents all screens, an
// HMONITOR of 0 indicates the same.
if (device_index == kFullDesktopScreenId) {
*hmonitor = 0;

View file

@ -19,30 +19,30 @@
namespace webrtc {
// Output the list of active screens into |screens|. Returns true if succeeded,
// or false if it fails to enumerate the display devices. If the |device_names|
// Output the list of active screens into `screens`. Returns true if succeeded,
// or false if it fails to enumerate the display devices. If the `device_names`
// is provided, it will be filled with the DISPLAY_DEVICE.DeviceName in UTF-8
// encoding. If this function returns true, consumers can always assume that
// |screens|[i] and |device_names|[i] indicate the same monitor on the system.
// `screens`[i] and `device_names`[i] indicate the same monitor on the system.
bool GetScreenList(DesktopCapturer::SourceList* screens,
std::vector<std::string>* device_names = nullptr);
// Converts a device index (which are returned by |GetScreenList|) into an
// Converts a device index (which are returned by `GetScreenList`) into an
// HMONITOR.
bool GetHmonitorFromDeviceIndex(const DesktopCapturer::SourceId device_index,
HMONITOR* hmonitor);
// Returns true if |monitor| represents a valid display
// Returns true if `monitor` represents a valid display
// monitor. Consumers should recheck the validity of HMONITORs before use if a
// WM_DISPLAYCHANGE message has been received.
bool IsMonitorValid(const HMONITOR monitor);
// Returns the rect of the monitor identified by |monitor|, relative to the
// Returns the rect of the monitor identified by `monitor`, relative to the
// primary display's top-left. On failure, returns an empty rect.
DesktopRect GetMonitorRect(const HMONITOR monitor);
// Returns true if |screen| is a valid screen. The screen device key is
// returned through |device_key| if the screen is valid. The device key can be
// Returns true if `screen` is a valid screen. The screen device key is
// returned through `device_key` if the screen is valid. The device key can be
// used in GetScreenRect to verify the screen matches the previously obtained
// id.
bool IsScreenValid(const DesktopCapturer::SourceId screen,
@ -52,8 +52,8 @@ bool IsScreenValid(const DesktopCapturer::SourceId screen,
// primary monitor always starts from (0, 0).
DesktopRect GetFullscreenRect();
// Get the rect of the screen identified by |screen|, relative to the primary
// display's top-left. If the screen device key does not match |device_key|, or
// Get the rect of the screen identified by `screen`, relative to the primary
// display's top-left. If the screen device key does not match `device_key`, or
// the screen does not exist, or any error happens, an empty rect is returned.
RTC_EXPORT DesktopRect GetScreenRect(const DesktopCapturer::SourceId screen,
const std::wstring& device_key);

View file

@ -52,18 +52,18 @@ class RTC_EXPORT ScreenCapturerWinDirectx : public DesktopCapturer {
// always try IsSupported() function.
static bool IsCurrentSessionSupported();
// Maps |device_names| with the result from GetScreenList() and creates a new
// SourceList to include only the ones in |device_names|. If this function
// returns true, consumers can always assume |device_names|.size() equals to
// |screens|->size(), meanwhile |device_names|[i] and |screens|[i] indicate
// Maps `device_names` with the result from GetScreenList() and creates a new
// SourceList to include only the ones in `device_names`. If this function
// returns true, consumers can always assume `device_names`.size() equals to
// `screens`->size(), meanwhile `device_names`[i] and `screens`[i] indicate
// the same monitor on the system.
// Public for test only.
static bool GetScreenListFromDeviceNames(
const std::vector<std::string>& device_names,
DesktopCapturer::SourceList* screens);
// Maps |id| with the result from GetScreenListFromDeviceNames() and returns
// the index of the entity in |device_names|. This function returns -1 if |id|
// Maps `id` with the result from GetScreenListFromDeviceNames() and returns
// the index of the entity in `device_names`. This function returns -1 if `id`
// cannot be found.
// Public for test only.
static int GetIndexFromScreenId(ScreenId id,

View file

@ -80,7 +80,7 @@ class ScreenCapturerWinMagnifier : public DesktopCapturer {
RECT clipped,
HRGN dirty);
// Captures the screen within |rect| in the desktop coordinates. Returns true
// Captures the screen within `rect` in the desktop coordinates. Returns true
// if succeeded.
// It can only capture the primary screen for now. The magnification library
// crashes under some screen configurations (e.g. secondary screen on top of
@ -95,7 +95,7 @@ class ScreenCapturerWinMagnifier : public DesktopCapturer {
// Called by OnMagImageScalingCallback to output captured data.
void OnCaptured(void* data, const MAGIMAGEHEADER& header);
// Makes sure the current frame exists and matches |size|.
// Makes sure the current frame exists and matches `size`.
void CreateCurrentFrameIfNecessary(const DesktopSize& size);
Callback* callback_ = nullptr;

View file

@ -256,7 +256,7 @@ HRESULT WgcCaptureSession::GetFrame(
}
}
// We need to copy |texture_2D| into |mapped_texture_| as the latter has the
// We need to copy `texture_2D` into `mapped_texture_` as the latter has the
// D3D11_CPU_ACCESS_READ flag set, which lets us access the image data.
// Otherwise it would only be readable by the GPU.
ComPtr<ID3D11DeviceContext> d3d_context;
@ -298,7 +298,7 @@ HRESULT WgcCaptureSession::GetFrame(
src_data += map_info.RowPitch;
}
// Transfer ownership of |image_data| to the output_frame.
// Transfer ownership of `image_data` to the output_frame.
DesktopSize size(image_width, image_height);
*output_frame = std::make_unique<WgcDesktopFrame>(size, row_data_length,
std::move(image_data));

View file

@ -47,17 +47,17 @@ class WgcCaptureSession final {
}
private:
// Initializes |mapped_texture_| with the properties of the |src_texture|,
// Initializes `mapped_texture_` with the properties of the `src_texture`,
// overrides the values of some necessary properties like the
// D3D11_CPU_ACCESS_READ flag. Also has optional parameters for what size
// |mapped_texture_| should be, if they aren't provided we will use the size
// of |src_texture|.
// `mapped_texture_` should be, if they aren't provided we will use the size
// of `src_texture`.
HRESULT CreateMappedTexture(
Microsoft::WRL::ComPtr<ID3D11Texture2D> src_texture,
UINT width = 0,
UINT height = 0);
// Event handler for |item_|'s Closed event.
// Event handler for `item_`'s Closed event.
HRESULT OnItemClosed(
ABI::Windows::Graphics::Capture::IGraphicsCaptureItem* sender,
IInspectable* event_args);

View file

@ -123,7 +123,7 @@ HRESULT WgcWindowSource::CreateCaptureItem(
WgcScreenSource::WgcScreenSource(DesktopCapturer::SourceId source_id)
: WgcCaptureSource(source_id) {
// Getting the HMONITOR could fail if the source_id is invalid. In that case,
// we leave hmonitor_ uninitialized and |IsCapturable()| will fail.
// we leave hmonitor_ uninitialized and `IsCapturable()` will fail.
HMONITOR hmon;
if (GetHmonitorFromDeviceIndex(GetSourceId(), &hmon))
hmonitor_ = hmon;

View file

@ -128,7 +128,7 @@ class WgcScreenSource final : public WgcCaptureSource {
// To maintain compatibility with other capturers, this class accepts a
// device index as it's SourceId. However, WGC requires we use an HMONITOR to
// describe which screen to capture. So, we internally convert the supplied
// device index into an HMONITOR when |IsCapturable()| is called.
// device index into an HMONITOR when `IsCapturable()` is called.
absl::optional<HMONITOR> hmonitor_;
};

View file

@ -75,7 +75,7 @@ class ScreenEnumerator final : public SourceEnumerator {
// A capturer that uses the Window.Graphics.Capture APIs. It is suitable for
// both window and screen capture (but only one type per instance). Consumers
// should not instantiate this class directly, instead they should use
// |CreateRawWindowCapturer()| or |CreateRawScreenCapturer()| to receive a
// `CreateRawWindowCapturer()` or `CreateRawScreenCapturer()` to receive a
// capturer appropriate for the type of source they want to capture.
class WgcCapturerWin : public DesktopCapturer {
public:

View file

@ -238,7 +238,7 @@ class WgcCapturerWinTest : public ::testing::TestWithParam<CaptureType>,
}
// DesktopCapturer::Callback interface
// The capturer synchronously invokes this method before |CaptureFrame()|
// The capturer synchronously invokes this method before `CaptureFrame()`
// returns.
void OnCaptureResult(DesktopCapturer::Result result,
std::unique_ptr<DesktopFrame> frame) override {

View file

@ -26,7 +26,7 @@ namespace webrtc {
// Windows.Graphics.Capture API.
class WgcDesktopFrame final : public DesktopFrame {
public:
// WgcDesktopFrame receives an rvalue reference to the |image_data| vector
// WgcDesktopFrame receives an rvalue reference to the `image_data` vector
// so that it can take ownership of it (and avoid a copy).
WgcDesktopFrame(DesktopSize size,
int stride,

View file

@ -79,7 +79,7 @@ BOOL CALLBACK GetWindowListHandler(HWND hwnd, LPARAM param) {
DesktopCapturer::Source window;
window.id = reinterpret_cast<WindowId>(hwnd);
// GetWindowText* are potentially blocking operations if |hwnd| is
// GetWindowText* are potentially blocking operations if `hwnd` is
// owned by the current process. The APIs will send messages to the window's
// message loop, and if the message loop is waiting on this operation we will
// enter a deadlock.
@ -228,7 +228,7 @@ bool GetWindowContentRect(HWND window, DesktopRect* result) {
// - We assume a window has same border width in each side.
// So we shrink half of the width difference from all four sides.
const int shrink = ((width - result->width()) / 2);
// When |shrink| is negative, DesktopRect::Extend() shrinks itself.
// When `shrink` is negative, DesktopRect::Extend() shrinks itself.
result->Extend(shrink, 0, shrink, 0);
// Usually this should not happen, just in case we have received a strange
// window, which has only left and right borders.
@ -364,7 +364,7 @@ bool WindowCaptureHelperWin::IsWindowChromeNotification(HWND hwnd) {
return false;
}
// |content_rect| is preferred because,
// `content_rect` is preferred because,
// 1. WindowCapturerWinGdi is using GDI capturer, which cannot capture DX
// output.
// So ScreenCapturer should be used as much as possible to avoid

View file

@ -28,13 +28,13 @@ bool GetWindowRect(HWND window, DesktopRect* result);
// Outputs the window rect, with the left/right/bottom frame border cropped if
// the window is maximized or has a transparent resize border.
// |avoid_cropping_border| may be set to true to avoid cropping the visible
// `avoid_cropping_border` may be set to true to avoid cropping the visible
// border when cropping any resize border.
// |cropped_rect| is the cropped rect relative to the
// desktop. |original_rect| is the original rect returned from GetWindowRect.
// `cropped_rect` is the cropped rect relative to the
// desktop. `original_rect` is the original rect returned from GetWindowRect.
// Returns true if all API calls succeeded. The returned DesktopRect is in
// system coordinates, i.e. the primary monitor on the system always starts from
// (0, 0). |original_rect| can be nullptr.
// (0, 0). `original_rect` can be nullptr.
//
// TODO(zijiehe): Move this function to CroppingWindowCapturerWin after it has
// been removed from MouseCursorMonitorWin.
@ -48,22 +48,22 @@ bool GetCroppedWindowRect(HWND window,
DesktopRect* cropped_rect,
DesktopRect* original_rect);
// Retrieves the rectangle of the content area of |window|. Usually it contains
// Retrieves the rectangle of the content area of `window`. Usually it contains
// title bar and window client area, but borders or shadow are excluded. The
// returned DesktopRect is in system coordinates, i.e. the primary monitor on
// the system always starts from (0, 0). This function returns false if native
// APIs fail.
bool GetWindowContentRect(HWND window, DesktopRect* result);
// Returns the region type of the |window| and fill |rect| with the region of
// |window| if region type is SIMPLEREGION.
// Returns the region type of the `window` and fill `rect` with the region of
// `window` if region type is SIMPLEREGION.
int GetWindowRegionTypeWithBoundary(HWND window, DesktopRect* result);
// Retrieves the size of the |hdc|. This function returns false if native APIs
// Retrieves the size of the `hdc`. This function returns false if native APIs
// fail.
bool GetDcSize(HDC hdc, DesktopSize* size);
// Retrieves whether the |window| is maximized and stores in |result|. This
// Retrieves whether the `window` is maximized and stores in `result`. This
// function returns false if native APIs fail.
bool IsWindowMaximized(HWND window, bool* result);
@ -88,7 +88,7 @@ enum GetWindowListFlags {
// - [with kIgnoreUntitled] windows with no title.
// - [with kIgnoreUnresponsive] windows that are unresponsive.
// - [with kIgnoreCurrentProcessWindows] windows owned by the current process.
// - Any windows with extended styles that match |ex_style_filters|.
// - Any windows with extended styles that match `ex_style_filters`.
// Returns false if native APIs failed.
bool GetWindowList(int flags,
DesktopCapturer::SourceList* windows,
@ -113,9 +113,9 @@ class WindowCaptureHelperWin {
bool IsWindowVisibleOnCurrentDesktop(HWND hwnd);
bool IsWindowCloaked(HWND hwnd);
// The optional |ex_style_filters| parameter allows callers to provide
// The optional `ex_style_filters` parameter allows callers to provide
// extended window styles (e.g. WS_EX_TOOLWINDOW) and prevent windows that
// match from being included in |results|.
// match from being included in `results`.
bool EnumerateCapturableWindows(DesktopCapturer::SourceList* results,
bool enumerate_current_process_windows,
LONG ex_style_filters = 0);

View file

@ -11,6 +11,7 @@
#include "modules/desktop_capture/win/window_capture_utils.h"
#include <winuser.h>
#include <algorithm>
#include <memory>
#include <mutex>

View file

@ -230,19 +230,19 @@ WindowCapturerWinGdi::CaptureResults WindowCapturerWinGdi::CaptureFrame(
DesktopSize window_dc_size;
if (GetDcSize(window_dc, &window_dc_size)) {
// The |window_dc_size| is used to detect the scaling of the original
// The `window_dc_size` is used to detect the scaling of the original
// window. If the application does not support high-DPI settings, it will
// be scaled by Windows according to the scaling setting.
// https://www.google.com/search?q=windows+scaling+settings&ie=UTF-8
// So the size of the |window_dc|, i.e. the bitmap we can retrieve from
// So the size of the `window_dc`, i.e. the bitmap we can retrieve from
// PrintWindow() or BitBlt() function, will be smaller than
// |original_rect| and |cropped_rect|. Part of the captured desktop frame
// `original_rect` and `cropped_rect`. Part of the captured desktop frame
// will be black. See
// bug https://bugs.chromium.org/p/webrtc/issues/detail?id=8112 for
// details.
// If |window_dc_size| is smaller than |window_rect|, let's resize both
// |original_rect| and |cropped_rect| according to the scaling factor.
// If `window_dc_size` is smaller than `window_rect`, let's resize both
// `original_rect` and `cropped_rect` according to the scaling factor.
// This will adjust the width and height of the two rects.
horizontal_scale =
static_cast<double>(window_dc_size.width()) / original_rect.width();
@ -251,8 +251,8 @@ WindowCapturerWinGdi::CaptureResults WindowCapturerWinGdi::CaptureFrame(
original_rect.Scale(horizontal_scale, vertical_scale);
cropped_rect.Scale(horizontal_scale, vertical_scale);
// Translate |cropped_rect| to the left so that its position within
// |original_rect| remains accurate after scaling.
// Translate `cropped_rect` to the left so that its position within
// `original_rect` remains accurate after scaling.
// See crbug.com/1083527 for more info.
int translate_left = static_cast<int>(std::round(
(cropped_rect.left() - original_rect.left()) * (horizontal_scale - 1)));

View file

@ -33,10 +33,10 @@ class WindowFinder {
WindowFinder() = default;
virtual ~WindowFinder() = default;
// Returns the id of the visible window under |point|. This function returns
// kNullWindowId if no window is under |point| and the platform does not have
// "root window" concept, i.e. the visible area under |point| is the desktop.
// |point| is always in system coordinate, i.e. the primary monitor always
// Returns the id of the visible window under `point`. This function returns
// kNullWindowId if no window is under `point` and the platform does not have
// "root window" concept, i.e. the visible area under `point` is the desktop.
// `point` is always in system coordinate, i.e. the primary monitor always
// starts from (0, 0).
virtual WindowId GetWindowUnderPoint(DesktopVector point) = 0;
@ -55,7 +55,7 @@ class WindowFinder {
};
// Creates a platform-independent WindowFinder implementation. This function
// returns nullptr if |options| does not contain enough information or
// returns nullptr if `options` does not contain enough information or
// WindowFinder does not support current platform.
static std::unique_ptr<WindowFinder> Create(const Options& options);
};