Use int64_t for desktop_capture Source and Screen IDs on ChromeOS
ChromeOS uses int64_t for its IDs (see display::Display::id()) so there is a potential for errors if casting (or attempting to hash and translate the larger ID to a smaller ID and vice versa). Instead we should update the desktop_capture component to use int64_t natively. Bug: webrtc:13571 Change-Id: I78b3456ce11b75755b90863a02f8c6455c63acf9 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/246240 Reviewed-by: Alexander Cooper <alcooper@chromium.org> Reviewed-by: Jeroen Dhollander <jeroendh@google.com> Commit-Queue: Joe Downing <joedow@google.com> Cr-Commit-Position: refs/heads/main@{#35724}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
42bf2c670c
commit
1d99f49cda
@ -27,9 +27,14 @@ const WindowId kNullWindowId = 0;
|
||||
// - On Windows: integer display device index.
|
||||
// - On OSX: CGDirectDisplayID cast to intptr_t.
|
||||
// - On Linux (with X11): TBD.
|
||||
// - On ChromeOS: display::Display::id() is an int64_t.
|
||||
// On Windows, ScreenId is implementation dependent: sending a ScreenId from one
|
||||
// implementation to another usually won't work correctly.
|
||||
typedef intptr_t ScreenId;
|
||||
#if defined(CHROMEOS)
|
||||
typedef int64_t ScreenId;
|
||||
#else
|
||||
typedef intptr_t ScreenId;
|
||||
#endif
|
||||
|
||||
// The screen id corresponds to all screen combined together.
|
||||
const ScreenId kFullDesktopScreenId = -1;
|
||||
|
@ -59,7 +59,11 @@ class RTC_EXPORT DesktopCapturer {
|
||||
virtual ~Callback() {}
|
||||
};
|
||||
|
||||
#if defined(CHROMEOS)
|
||||
typedef int64_t SourceId;
|
||||
#else
|
||||
typedef intptr_t SourceId;
|
||||
#endif
|
||||
|
||||
static_assert(std::is_same<SourceId, ScreenId>::value,
|
||||
"SourceId should be a same type as ScreenId.");
|
||||
|
Reference in New Issue
Block a user