mirror of
https://github.com/sipeed/MaixCDK.git
synced 2026-09-12 22:59:44 -05:00
* optimize rtmp
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user