Fixed crash

This commit is contained in:
WolverinDEV 2020-11-30 19:06:18 +01:00
parent 8714761afa
commit 706cecb66c
2 changed files with 9 additions and 7 deletions

View File

@ -285,8 +285,8 @@ void Server::reset_rtp_session(RTCClientId client_id) {
librtc_reset_rtp_session(this->server_ptr, client_id);
}
bool Server::apply_remote_description(std::string &error, RTCClientId client_id, uint32_t mode, const std::string_view &description) {
auto error_ptr = librtc_apply_remote_description(this->server_ptr, client_id, mode, description.data());
bool Server::apply_remote_description(std::string &error, RTCClientId client_id, uint32_t mode, const std::string &description) {
auto error_ptr = librtc_apply_remote_description(this->server_ptr, client_id, mode, description.c_str());
if(!error_ptr) { return true; }
error = std::string{error_ptr};
@ -308,8 +308,8 @@ bool Server::generate_local_description(RTCClientId client, std::string &result)
}
}
bool Server::add_ice_candidate(std::string &error, RTCClientId client_id, uint32_t media_line, const std::string_view &description) {
auto error_ptr = librtc_add_ice_candidate(this->server_ptr, client_id, media_line, description.length() == 0 ? nullptr : description.data());
bool Server::add_ice_candidate(std::string &error, RTCClientId client_id, uint32_t media_line, const std::string &description) {
auto error_ptr = librtc_add_ice_candidate(this->server_ptr, client_id, media_line, description.length() == 0 ? nullptr : description.c_str());
if(!error_ptr) { return true; }
error = std::string{error_ptr};
@ -382,5 +382,7 @@ NativeAudioSourceSupplier::~NativeAudioSourceSupplier() noexcept {
}
void NativeAudioSourceSupplier::send_audio(uint16_t seq_no, bool marked, uint32_t timestamp, uint8_t codec, const std::string_view &data) {
librtc_audio_source_supply(this->sender_ptr, seq_no, marked, timestamp, codec, data.empty() ? nullptr : data.data(), data.length());
if(this->sender_ptr) {
librtc_audio_source_supply(this->sender_ptr, seq_no, marked, timestamp, codec, data.empty() ? nullptr : data.data(), data.length());
}
}

View File

@ -45,9 +45,9 @@ namespace ts::rtc {
/* RTC client actions */
void reset_rtp_session(RTCClientId /* client */);
bool apply_remote_description(std::string& /* error */, RTCClientId /* client id */, uint32_t /* mode */, const std::string_view& /* description */);
bool apply_remote_description(std::string& /* error */, RTCClientId /* client id */, uint32_t /* mode */, const std::string& /* description */);
bool generate_local_description(RTCClientId /* client id */, std::string& /* result */);
bool add_ice_candidate(std::string& /* error */, RTCClientId /* client id */, uint32_t /* media line */, const std::string_view& /* description */);
bool add_ice_candidate(std::string& /* error */, RTCClientId /* client id */, uint32_t /* media line */, const std::string& /* description */);
void ice_candidates_finished(RTCClientId /* client id */);
/* Native client actions */