新增获取推流推流代理列表和ffmpeg源列表接口 (#3992)

This commit is contained in:
mtdxc
2024-11-01 10:47:18 +08:00
committed by GitHub
parent 6729257eab
commit 901c381300
11 changed files with 176 additions and 14 deletions

View File

@@ -46,6 +46,7 @@ void MediaPusher::publish(const string &url) {
_delegate->setOnPublished(_on_publish);
_delegate->mINI::operator=(*this);
_delegate->publish(url);
_url = url;
}
EventPoller::Ptr MediaPusher::getPoller(){

View File

@@ -33,11 +33,13 @@ public:
void publish(const std::string &url) override;
toolkit::EventPoller::Ptr getPoller();
void setOnCreateSocket(toolkit::Socket::onCreateSocket cb);
std::shared_ptr<MediaSource> getSrc() { return _src.lock(); }
const std::string& getUrl() const { return _url; }
private:
std::weak_ptr<MediaSource> _src;
toolkit::EventPoller::Ptr _poller;
toolkit::Socket::onCreateSocket _on_create_socket;
std::string _url;
};
} /* namespace mediakit */

View File

@@ -19,7 +19,6 @@ PusherProxy::PusherProxy(const MediaSource::Ptr &src, int retry_count, const Eve
: MediaPusher(src, poller) {
_retry_count = retry_count;
_on_close = [](const SockException &) {};
_weak_src = src;
_live_secs = 0;
_live_status = 1;
_republish_count = 0;
@@ -52,7 +51,7 @@ void PusherProxy::publish(const string &dst_url) {
strong_self->_on_publish = nullptr;
}
auto src = strong_self->_weak_src.lock();
auto src = strong_self->getSrc();
if (!err) {
// 推流成功 [AUTO-TRANSLATED:28ce6e56]
// Stream successfully pushed
@@ -87,7 +86,7 @@ void PusherProxy::publish(const string &dst_url) {
TraceL << " live secs " << strong_self->_live_secs;
}
auto src = strong_self->_weak_src.lock();
auto src = strong_self->getSrc();
// 推流异常中断,延时重试播放 [AUTO-TRANSLATED:e69e5a05]
// Stream abnormally interrupted, retry playing with delay
if (src && (*failed_cnt < strong_self->_retry_count || strong_self->_retry_count < 0)) {

View File

@@ -77,7 +77,6 @@ private:
std::atomic<int> _live_status;
std::atomic<uint64_t> _live_secs;
std::atomic<uint64_t> _republish_count;
std::weak_ptr<MediaSource> _weak_src;
std::function<void(const toolkit::SockException &ex)> _on_close;
std::function<void(const toolkit::SockException &ex)> _on_publish;
};