Skip to content

Commit 5ffcdc3

Browse files
authored
Merge pull request #5539 from secondlife/marchcat/slua-26.1-webrtc
26.1 -> SLua PV merge
2 parents 28958ab + 419f94f commit 5ffcdc3

43 files changed

Lines changed: 570 additions & 202 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

autobuild.xml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,18 +2473,28 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
24732473
</map>
24742474
<key>webrtc</key>
24752475
<map>
2476+
<key>canonical_repo</key>
2477+
<string>https://github.com/secondlife/3p-webrtc-build</string>
2478+
<key>copyright</key>
2479+
<string>Copyright (c) 2011, The WebRTC project authors. All rights reserved.</string>
2480+
<key>license</key>
2481+
<string>MIT</string>
2482+
<key>license_file</key>
2483+
<string>LICENSES/webrtc-license.txt</string>
2484+
<key>name</key>
2485+
<string>webrtc</string>
24762486
<key>platforms</key>
24772487
<map>
24782488
<key>darwin64</key>
24792489
<map>
24802490
<key>archive</key>
24812491
<map>
24822492
<key>hash</key>
2483-
<string>a5e72a9d13b6c4646d1e02b5820f16560d204de7</string>
2493+
<string>7338377a9c6913bc8768d446fe627b8176bc89d4</string>
24842494
<key>hash_algorithm</key>
24852495
<string>sha1</string>
24862496
<key>url</key>
2487-
<string>https://github.com/secondlife/3p-webrtc-build/releases/download/m137.7151.04.21/webrtc-m137.7151.04.21.18609120431-darwin64-18609120431.tar.zst</string>
2497+
<string>https://github.com/secondlife/3p-webrtc-build/releases/download/m137.7151.04.23/webrtc-m137.7151.04.23.22004231636-darwin64-22004231636.tar.zst</string>
24882498
</map>
24892499
<key>name</key>
24902500
<string>darwin64</string>
@@ -2494,11 +2504,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
24942504
<key>archive</key>
24952505
<map>
24962506
<key>hash</key>
2497-
<string>1030e5086f401d738463223da3ed99c225340f39</string>
2507+
<string>a2df83ed8d7fc1374398d7a37633bae17f5d68a1</string>
24982508
<key>hash_algorithm</key>
24992509
<string>sha1</string>
25002510
<key>url</key>
2501-
<string>https://github.com/secondlife/3p-webrtc-build/releases/download/m137.7151.04.21/webrtc-m137.7151.04.21.18609120431-linux64-18609120431.tar.zst</string>
2511+
<string>https://github.com/secondlife/3p-webrtc-build/releases/download/m137.7151.04.23/webrtc-m137.7151.04.23.22004231636-linux64-22004231636.tar.zst</string>
25022512
</map>
25032513
<key>name</key>
25042514
<string>linux64</string>
@@ -2508,34 +2518,24 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
25082518
<key>archive</key>
25092519
<map>
25102520
<key>hash</key>
2511-
<string>d1cae9bc8866ca01aa9f5e72b36d12ef608b1998</string>
2521+
<string>665c2447c794a88542fab30638f0013bea58480c</string>
25122522
<key>hash_algorithm</key>
25132523
<string>sha1</string>
25142524
<key>url</key>
2515-
<string>https://github.com/secondlife/3p-webrtc-build/releases/download/m137.7151.04.21/webrtc-m137.7151.04.21.18609120431-windows64-18609120431.tar.zst</string>
2525+
<string>https://github.com/secondlife/3p-webrtc-build/releases/download/m137.7151.04.23/webrtc-m137.7151.04.23.22004231636-windows64-22004231636.tar.zst</string>
25162526
</map>
25172527
<key>name</key>
25182528
<string>windows64</string>
25192529
</map>
25202530
</map>
2521-
<key>license</key>
2522-
<string>MIT</string>
2523-
<key>license_file</key>
2524-
<string>LICENSES/webrtc-license.txt</string>
2525-
<key>copyright</key>
2526-
<string>Copyright (c) 2011, The WebRTC project authors. All rights reserved.</string>
2527-
<key>version</key>
2528-
<string>m137.7151.04.21.18609120431</string>
2529-
<key>name</key>
2530-
<string>webrtc</string>
25312531
<key>vcs_branch</key>
25322532
<string>secondlife</string>
25332533
<key>vcs_revision</key>
25342534
<string>d3f62d32bac8694d3c7423c731ae30c113bf6a11</string>
25352535
<key>vcs_url</key>
25362536
<string>https://github.com/secondlife/3p-webrtc-build</string>
2537-
<key>canonical_repo</key>
2538-
<string>https://github.com/secondlife/3p-webrtc-build</string>
2537+
<key>version</key>
2538+
<string>m137.7151.04.23.22004231636</string>
25392539
</map>
25402540
<key>xxhash</key>
25412541
<map>

indra/llcommon/lleventcoro.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ void llcoro::suspendUntilTimeout(float seconds)
137137
suspendUntilEventOnWithTimeout(bogus, seconds, timedout);
138138
}
139139

140+
void llcoro::suspendUntilNextFrame()
141+
{
142+
LLCoros::checkStop();
143+
LLCoros::TempStatus st("waiting for next frame");
144+
145+
// Listen for the next event on the "mainloop" event pump.
146+
// Once per frame we get mainloop.post(newFrame);
147+
LLEventPumpOrPumpName mainloop_pump("mainloop");
148+
// Wait for the next event (the event data is ignored).
149+
suspendUntilEventOn(mainloop_pump);
150+
}
151+
140152
namespace
141153
{
142154

indra/llcommon/lleventcoro.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ void suspend();
8484
*/
8585
void suspendUntilTimeout(float seconds);
8686

87+
/**
88+
* Yield control from a coroutine until the next mainloop's newFrame event.
89+
*/
90+
void suspendUntilNextFrame();
91+
8792
/**
8893
* Post specified LLSD event on the specified LLEventPump, then suspend for a
8994
* response on specified other LLEventPump. This is more than mere

indra/llcommon/llthread.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@ void LLThread::tryRun()
236236
LL::WorkQueue::ptr_t main_queue = LL::WorkQueue::getInstance("mainloop");
237237
main_queue->post(
238238
// Bind the current exception, rethrow it in main loop.
239-
[exc = std::current_exception()]() { std::rethrow_exception(exc); });
239+
[exc = std::current_exception(), name = mName]()
240+
{
241+
LL_INFOS("THREAD") << "Rethrowing exception from thread " << name << LL_ENDL;
242+
std::rethrow_exception(exc);
243+
});
240244
}
241245
#endif // else LL_WINDOWS
242246
}

indra/llcommon/workqueue.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,15 @@ void LL::WorkQueueBase::callWork(const Work& work)
216216
LL_WARNS("LLCoros") << "Capturing and rethrowing uncaught exception in WorkQueueBase "
217217
<< getKey() << LL_ENDL;
218218

219+
std::string name = getKey();
219220
LL::WorkQueue::ptr_t main_queue = LL::WorkQueue::getInstance("mainloop");
220221
main_queue->post(
221222
// Bind the current exception, rethrow it in main loop.
222-
[exc = std::current_exception()]() { std::rethrow_exception(exc); });
223+
[exc = std::current_exception(), name]()
224+
{
225+
LL_INFOS("LLCoros") << "Rethrowing exception from WorkQueueBase::callWork " << name << LL_ENDL;
226+
std::rethrow_exception(exc);
227+
});
223228
}
224229
else
225230
{

indra/llcommon/workqueue.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,11 @@ namespace LL
530530
reply,
531531
// Bind the current exception to transport back to the
532532
// originating WorkQueue. Once there, rethrow it.
533-
[exc = std::current_exception()](){ std::rethrow_exception(exc); });
533+
[exc = std::current_exception()]()
534+
{
535+
LL_INFOS("LLCoros") << "Rethrowing exception from WorkQueueBase::postTo" << LL_ENDL;
536+
std::rethrow_exception(exc);
537+
});
534538
}
535539
},
536540
// if caller passed a TimePoint, pass it along to post()

indra/llimage/llimage.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,20 @@ U8* LLImageBase::allocateData(S32 size)
709709
mData = (U8*)ll_aligned_malloc_16(size);
710710
if (!mData)
711711
{
712-
LL_WARNS() << "Failed to allocate image data size [" << size << "]" << LL_ENDL;
713-
mBadBufferAllocation = true;
712+
constexpr S32 MAX_TOLERANCE = 1024 * 1024 * 4; // 4 MB
713+
if (size > MAX_TOLERANCE)
714+
{
715+
// If a big image failed to allocate, tollerate it for now.
716+
// It's insightfull when crash logs without obvious cause are being analyzed,
717+
// so a crash in a random location that normally is a mystery can get proper handling.
718+
LL_WARNS() << "Failed to allocate image data size [" << size << "]" << LL_ENDL;
719+
}
720+
else
721+
{
722+
// We are too far gone if we can't allocate a small buffer.
723+
LLError::LLUserWarningMsg::showOutOfMemory();
724+
LL_ERRS() << "Failed to allocate image data size [" << size << "]" << LL_ENDL;
725+
}
714726
}
715727
}
716728

indra/llmessage/llassetstorage.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,9 @@ const char* LLAssetStorage::getErrorString(S32 status)
13161316
case LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE:
13171317
return "Asset request: asset not found in database";
13181318

1319+
case LL_ERR_NO_CAP:
1320+
return "Asset request: region or asset capability not available";
1321+
13191322
case LL_ERR_EOF:
13201323
return "End of file";
13211324

indra/llmessage/llassetstorage.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const int LL_ERR_ASSET_REQUEST_FAILED = -1;
5757
const int LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE = -3;
5858
const int LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4;
5959
const int LL_ERR_INSUFFICIENT_PERMISSIONS = -5;
60+
const int LL_ERR_NO_CAP = -6;
6061
const int LL_ERR_PRICE_MISMATCH = -23018;
6162

6263
// *TODO: these typedefs are passed into the cache via a legacy C function pointer

indra/llmessage/llexperiencecache.cpp

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ void LLExperienceCache::initSingleton()
114114
constexpr size_t CORO_QUEUE_SIZE = 2048;
115115
LLCoprocedureManager::instance().initializePool("ExpCache", CORO_QUEUE_SIZE);
116116

117-
LLCoros::instance().launch("LLExperienceCache::idleCoro",
118-
boost::bind(&LLExperienceCache::idleCoro, this));
119-
117+
LLCoros::instance().launch("LLExperienceCache::idleCoro", LLExperienceCache::idleCoro);
120118
}
121119

122120
void LLExperienceCache::cleanup()
@@ -248,6 +246,7 @@ const LLExperienceCache::cache_t& LLExperienceCache::getCached()
248246
return mCache;
249247
}
250248

249+
// static because used by coroutine and can outlive the instance
251250
void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, std::string url, RequestQueue_t requests)
252251
{
253252
LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>();
@@ -256,6 +255,13 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap
256255

257256
LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
258257

258+
if (sShutdown)
259+
{
260+
return;
261+
}
262+
263+
LLExperienceCache* self = LLExperienceCache::getInstance();
264+
259265
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
260266
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
261267

@@ -267,7 +273,7 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap
267273
// build dummy entries for the failed requests
268274
for (RequestQueue_t::const_iterator it = requests.begin(); it != requests.end(); ++it)
269275
{
270-
LLSD exp = get(*it);
276+
LLSD exp = self->get(*it);
271277
//leave the properties alone if we already have a cache entry for this xp
272278
if (exp.isUndefined())
273279
{
@@ -280,7 +286,7 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap
280286
exp["error"] = (LLSD::Integer)status.getType();
281287
exp[QUOTA] = DEFAULT_QUOTA;
282288

283-
processExperience(*it, exp);
289+
self->processExperience(*it, exp);
284290
}
285291
return;
286292
}
@@ -296,7 +302,7 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap
296302
LL_DEBUGS("ExperienceCache") << "Received result for " << public_key
297303
<< " display '" << row[LLExperienceCache::NAME].asString() << "'" << LL_ENDL;
298304

299-
processExperience(public_key, row);
305+
self->processExperience(public_key, row);
300306
}
301307

302308
LLSD error_ids = result["error_ids"];
@@ -312,7 +318,7 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap
312318
exp[MISSING] = true;
313319
exp[QUOTA] = DEFAULT_QUOTA;
314320

315-
processExperience(id, exp);
321+
self->processExperience(id, exp);
316322
LL_WARNS("ExperienceCache") << "LLExperienceResponder::result() error result for " << id << LL_ENDL;
317323
}
318324

@@ -363,7 +369,7 @@ void LLExperienceCache::requestExperiences()
363369
if (mRequestQueue.empty() || (ostr.tellp() > EXP_URL_SEND_THRESHOLD))
364370
{ // request is placed in the coprocedure pool for the ExpCache cache. Throttling is done by the pool itself.
365371
LLCoprocedureManager::instance().enqueueCoprocedure("ExpCache", "RequestExperiences",
366-
boost::bind(&LLExperienceCache::requestExperiencesCoro, this, _1, ostr.str(), requests) );
372+
boost::bind(&LLExperienceCache::requestExperiencesCoro, _1, ostr.str(), requests) );
367373

368374
ostr.str(std::string());
369375
ostr << urlBase << "?page_size=" << PAGE_SIZE1;
@@ -395,7 +401,7 @@ void LLExperienceCache::setCapabilityQuery(LLExperienceCache::CapabilityQuery_t
395401
mCapability = queryfn;
396402
}
397403

398-
404+
// static, because coro can outlive the instance
399405
void LLExperienceCache::idleCoro()
400406
{
401407
const F32 SECS_BETWEEN_REQUESTS = 0.5f;
@@ -404,14 +410,15 @@ void LLExperienceCache::idleCoro()
404410
LL_INFOS("ExperienceCache") << "Launching Experience cache idle coro." << LL_ENDL;
405411
do
406412
{
407-
if (mEraseExpiredTimer.checkExpirationAndReset(ERASE_EXPIRED_TIMEOUT))
413+
LLExperienceCache* self = LLExperienceCache::getInstance();
414+
if (self->mEraseExpiredTimer.checkExpirationAndReset(ERASE_EXPIRED_TIMEOUT))
408415
{
409-
eraseExpired();
416+
self->eraseExpired();
410417
}
411418

412-
if (!mRequestQueue.empty())
419+
if (!self->mRequestQueue.empty())
413420
{
414-
requestExperiences();
421+
self->requestExperiences();
415422
}
416423

417424
llcoro::suspendUntilTimeout(SECS_BETWEEN_REQUESTS);

0 commit comments

Comments
 (0)