diff --git a/headers/rtc_4.5.0/include/rte_base/c/c_rte.h b/headers/rtc_4.5.0/include/rte_base/c/c_rte.h index 4e04077..8160b32 100644 --- a/headers/rtc_4.5.0/include/rte_base/c/c_rte.h +++ b/headers/rtc_4.5.0/include/rte_base/c/c_rte.h @@ -93,7 +93,7 @@ AGORA_RTE_API_C void RteConfigGetJsonParameter(RteConfig *config, RteError *err); AGORA_RTE_API_C Rte RteCreate(RteInitialConfig *config, RteError *err); -AGORA_RTE_API_C void RteDestroy(Rte *self, RteError *err); +AGORA_RTE_API_C bool RteDestroy(Rte *self, RteError *err); AGORA_RTE_API_C bool RteInitMediaEngine(Rte *self, void (*cb)(Rte *self, void *cb_data, diff --git a/headers/rtc_4.5.0/include/rte_base/rte_cpp_rte.h b/headers/rtc_4.5.0/include/rte_base/rte_cpp_rte.h index 41759eb..9823853 100644 --- a/headers/rtc_4.5.0/include/rte_base/rte_cpp_rte.h +++ b/headers/rtc_4.5.0/include/rte_base/rte_cpp_rte.h @@ -269,7 +269,7 @@ class Rte { * @param config Rte object initialization configuration object. */ explicit Rte(InitialConfig *config = nullptr): c_rte(::RteCreate(config != nullptr ? &config->c_rte_init_cfg : nullptr, nullptr)) {} - ~Rte(){RteDestroy(&c_rte, nullptr);}; + ~Rte(){Destroy();}; /** * Construct a new Rte object. @@ -375,6 +375,20 @@ class Rte { return RteSetConfigs(&c_rte, config != nullptr ? config->get_underlying_impl(): nullptr, err != nullptr ? err->get_underlying_impl() : nullptr); } + /** + * Destroy the Rte object. The operation will release all resources used by the Rte object. + * @since v4.4.0 + * @param err Possible return values for ErrorCode: + * - kRteOk: Success + * - kRteErrorInvalidOperation: The corresponding internal Rte object has been destroyed or is invalid. + * @return bool Returns the result of destroying the Rte object. + * - true: Successfully destroyed. + * - false: Failed to destroy. + */ + bool Destroy(Error *err = nullptr){ + return RteDestroy(&c_rte, err != nullptr ? err->get_underlying_impl() : nullptr); + } + private: explicit Rte(::Rte other) { c_rte = other; }