* optimize rtmp

This commit is contained in:
lxowalle
2024-05-15 21:13:19 +08:00
parent f8b834cfdd
commit 115dab3c89
3 changed files with 6 additions and 5 deletions

View File

@@ -14,7 +14,8 @@
#include <stdexcept>
#include <pthread.h>
namespace maix {
namespace maix::rtmp
{
/**
* Rtmp class
* @maixpy maix.rtmp.Rtmp
@@ -116,7 +117,7 @@ namespace maix {
/**
* @brief Get the file path of the push stream
* @return error code, err::ERR_NONE means success, others means failed
* @return file path
* @maixpy maix.rtmp.Rtmp.get_path
*/
std::string get_path() {
@@ -125,7 +126,7 @@ namespace maix {
/**
* @brief Check whether push streaming has started
* @return error code, err::ERR_NONE means success, others means failed
* @return If rtmp thread is running, returns true
* @maixpy maix.rtmp.Rtmp.get_path
*/
bool is_started() {

View File

@@ -22,7 +22,7 @@ static int rtmp_client_send(void* param, const void* header, size_t len, const v
return socket_send_v_all_by_time(*socket, vec, bytes > 0 ? 2 : 1, 0, 5000);
}
namespace maix {
namespace maix::rtmp {
Rtmp::Rtmp(std::string host, int port, std::string app, std::string stream) {
_host = host;
_port = port;

View File

@@ -49,7 +49,7 @@ int _main(int argc, char* argv[])
std::string file = argv[5];
printf("push %s to rtmp://%s:%d/%s/%s!\r\n", &file[0], &host[0], port, &app[0], &stream[0]);
Rtmp rtmp = Rtmp(host, port, app, stream);
rtmp::Rtmp rtmp = rtmp::Rtmp(host, port, app, stream);
log::info("start\r\n");
rtmp.start(file);