more fixes

This commit is contained in:
bernatx 2023-06-12 16:58:58 +02:00 committed by bernat
parent 59fb4b3ede
commit 77c290f55f
3 changed files with 6 additions and 10 deletions

View File

@ -43,10 +43,8 @@ namespace detail {
/// messages sent through the stream are big and have (approximately) the
/// same size.
Buffer MakeBuffer() {
if (_shared_state)
return _shared_state->MakeBuffer();
else
return Buffer();
auto state = _shared_state;
return state->MakeBuffer();
}
/// Flush @a buffers down the stream. No copies are made.

View File

@ -19,10 +19,8 @@ namespace detail {
StreamStateBase::~StreamStateBase() = default;
Buffer StreamStateBase::MakeBuffer() {
if (_buffer_pool)
return _buffer_pool->Pop();
else
return Buffer();
auto pool = _buffer_pool;
return pool->Pop();
}
} // namespace detail

View File

@ -100,14 +100,14 @@ void ASensor::PostActorCreated()
void ASensor::EndPlay(EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
// close all sessions associated to the sensor stream
auto *GameInstance = UCarlaStatics::GetGameInstance(GetEpisode().GetWorld());
auto &StreamingServer = GameInstance->GetServer().GetStreamingServer();
auto StreamId = carla::streaming::detail::token_type(Stream.GetToken()).get_stream_id();
StreamingServer.CloseStream(StreamId);
Stream = FDataStream();
// Stream = FDataStream();
UCarlaEpisode* Episode = UCarlaStatics::GetCurrentEpisode(GetWorld());
if(Episode)