Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit c47a43b

Browse files
authored
Fix Linux build errors after QUIC build is enabled. (#502)
* Fix Linux build errors after quic is enabled. * Check result of snprintf.
1 parent 168dfca commit c47a43b

File tree

5 files changed

+22
-15
lines changed

5 files changed

+22
-15
lines changed

DEPS

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3069,18 +3069,6 @@ hooks = [
30693069
'condition': 'checkout_mac',
30703070
'action': ['python', 'src/build/mac_toolchain.py'],
30713071
},
3072-
# Pull binutils for linux, enabled debug fission for faster linking /
3073-
# debugging when used with clang on Ubuntu Precise.
3074-
# https://code.google.com/p/chromium/issues/detail?id=352046
3075-
{
3076-
'name': 'binutils',
3077-
'pattern': 'src/third_party/binutils',
3078-
'condition': 'host_os == "linux"',
3079-
'action': [
3080-
'python',
3081-
'src/third_party/binutils/download.py',
3082-
],
3083-
},
30843072
{
30853073
# Note: On Win, this should run after win_toolchain, as it may use it.
30863074
'name': 'clang',

scripts/build_linux.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def gen_lib_path(scheme):
4646
out_lib = OUT_LIB % {'scheme': scheme}
4747
return os.path.join(r'out', out_lib)
4848

49-
def gngen(arch, ssl_root, msdk_root, scheme, tests, use_gcc, fake_audio):
49+
def gngen(arch, ssl_root, msdk_root, quic_root, scheme, tests, use_gcc, fake_audio):
5050
gn_args = list(GN_ARGS)
5151
gn_args.append('target_cpu="%s"' % arch)
5252
if scheme == 'release':
@@ -70,6 +70,16 @@ def gngen(arch, ssl_root, msdk_root, scheme, tests, use_gcc, fake_audio):
7070
gn_args.append('owt_msdk_lib_root="%s"' % msdk_lib)
7171
else:
7272
print('msdk_root is not set.')
73+
if quic_root:
74+
gn_args.append('owt_quic_header_root="%s"' % (quic_root + r'\include'))
75+
if scheme == 'release':
76+
quic_lib = quic_root + r'\bin\release'
77+
elif scheme == 'debug':
78+
quic_lib = quic_root + r'\bin\debug'
79+
else:
80+
return False
81+
gn_args.append('owt_use_quic=true')
82+
7383
if tests:
7484
gn_args.append('rtc_include_tests=true')
7585
gn_args.append('owt_include_tests=true')
@@ -149,6 +159,7 @@ def main():
149159
help='Target architecture. Supported value: x86, x64')
150160
parser.add_argument('--ssl_root', help='Path for OpenSSL.')
151161
parser.add_argument('--msdk_root', help='Path for MSDK.')
162+
parser.add_argument('--quic_root', help='Path to QUIC library')
152163
parser.add_argument('--scheme', default='debug', choices=('debug', 'release'),
153164
help='Schemes for building. Supported value: debug, release')
154165
parser.add_argument('--gn_gen', default=False, action='store_true',
@@ -166,7 +177,7 @@ def main():
166177
opts = parser.parse_args()
167178
print(opts)
168179
if opts.gn_gen:
169-
if not gngen(opts.arch, opts.ssl_root, opts.msdk_root, opts.scheme, opts.tests, opts.use_gcc, opts.fake_audio):
180+
if not gngen(opts.arch, opts.ssl_root, opts.msdk_root, opts.quic_root, opts.scheme, opts.tests, opts.use_gcc, opts.fake_audio):
170181
return 1
171182
if opts.sdk:
172183
if not ninjabuild(opts.arch, opts.scheme):

talk/owt/sdk/base/stream.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,12 @@ void Stream::TriggerOnStreamUnmute(TrackKind track_kind) {
385385
}
386386
#if !defined(WEBRTC_WIN)
387387
LocalStream::LocalStream() {}
388+
#if !defined(WEBRTC_LINUX)
388389
LocalStream::LocalStream(MediaStreamInterface* media_stream,
389390
StreamSourceInfo source)
390391
: Stream(media_stream, source) {}
391392
#endif
393+
#endif
392394
LocalStream::~LocalStream() {
393395
RTC_LOG(LS_INFO) << "Destroy LocalCameraStream.";
394396
if (media_stream_ != nullptr) {

talk/owt/sdk/conference/conferencewebtransportchannel.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,15 @@ static std::string ConvertToUUID(uint8_t* src) {
373373
return "";
374374
char* dst = new char[UUID_TEXT_LEN_PLUS_1];
375375
memset(dst, 0, UUID_TEXT_LEN_PLUS_1);
376-
sprintf_s(dst, UUID_TEXT_LEN_PLUS_1,
376+
int bytes_written = snprintf(dst, UUID_TEXT_LEN_PLUS_1,
377377
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
378378
src[0], src[1], src[2], src[3], src[4], src[5], src[6], src[7],
379379
src[8], src[9], src[10], src[11], src[12], src[13], src[14],
380380
src[15]);
381+
if (bytes_written <= 0 || bytes_written > UUID_TEXT_LEN_PLUS_1) {
382+
delete []dst;
383+
return "";
384+
}
381385
std::string uuid(dst);
382386
delete []dst;
383387
return uuid;

talk/owt/sdk/include/cpp/owt/base/stream.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,9 @@ class LocalStream : public Stream {
259259
public:
260260
#if !defined(WEBRTC_WIN)
261261
LocalStream();
262+
#if !defined(WEBRTC_LINUX)
262263
LocalStream(MediaStreamInterface* media_stream, StreamSourceInfo source);
264+
#endif
263265
#endif
264266
virtual ~LocalStream();
265267
using Stream::Attributes;

0 commit comments

Comments
 (0)