├── msnet
├── librtmp
├── libRtmp.aps
├── libRtmp.rc
├── librtmp.so.0
├── resource.h
├── testlibrtmp
├── libRtmp.vcxproj.user
├── ReadMe.txt
└── http.h
├── .gitmodules
├── .vscode
├── tasks.json
└── launch.json
├── README.md
├── .gitignore
├── .clang-format
├── asio-1.12.2
└── asio
│ ├── unyield.hpp
│ ├── yield.hpp
│ ├── ts
│ ├── io_context.hpp
│ ├── buffer.hpp
│ ├── net.hpp
│ ├── timer.hpp
│ ├── socket.hpp
│ ├── executor.hpp
│ └── internet.hpp
│ ├── io_service_strand.hpp
│ ├── experimental.hpp
│ ├── buffered_stream_fwd.hpp
│ ├── version.hpp
│ ├── buffered_read_stream_fwd.hpp
│ ├── buffered_write_stream_fwd.hpp
│ ├── impl
│ ├── src.cpp
│ ├── system_context.hpp
│ ├── executor.ipp
│ ├── serial_port_base.hpp
│ ├── handler_alloc_hook.ipp
│ ├── system_context.ipp
│ └── thread_pool.ipp
│ ├── detail
│ ├── limits.hpp
│ ├── cstddef.hpp
│ ├── date_time_fwd.hpp
│ ├── regex_fwd.hpp
│ ├── dependent_type.hpp
│ ├── win_iocp_thread_info.hpp
│ ├── assert.hpp
│ ├── operation.hpp
│ ├── reactor.hpp
│ ├── array_fwd.hpp
│ ├── array.hpp
│ ├── functional.hpp
│ ├── noncopyable.hpp
│ ├── wait_op.hpp
│ ├── fd_set_adapter.hpp
│ ├── scheduler_thread_info.hpp
│ ├── null_fenced_block.hpp
│ ├── resolve_op.hpp
│ ├── signal_init.hpp
│ ├── timer_scheduler.hpp
│ ├── reactor_fwd.hpp
│ ├── thread_context.hpp
│ ├── signal_op.hpp
│ ├── future.hpp
│ ├── impl
│ │ ├── posix_mutex.ipp
│ │ ├── posix_tss_ptr.ipp
│ │ ├── win_tss_ptr.ipp
│ │ └── posix_event.ipp
│ ├── timer_scheduler_fwd.hpp
│ ├── mutex.hpp
│ ├── event.hpp
│ ├── null_static_mutex.hpp
│ ├── null_mutex.hpp
│ ├── signal_blocker.hpp
│ ├── throw_error.hpp
│ ├── global.hpp
│ ├── handler_cont_helpers.hpp
│ ├── null_global.hpp
│ ├── null_tss_ptr.hpp
│ ├── atomic_count.hpp
│ ├── select_interrupter.hpp
│ ├── solaris_fenced_block.hpp
│ ├── macos_fenced_block.hpp
│ ├── std_fenced_block.hpp
│ ├── null_thread.hpp
│ ├── std_mutex.hpp
│ ├── string_view.hpp
│ ├── local_free_on_block_exit.hpp
│ ├── throw_exception.hpp
│ ├── keyword_tss_ptr.hpp
│ ├── posix_static_mutex.hpp
│ ├── std_thread.hpp
│ ├── winrt_async_op.hpp
│ ├── cstdint.hpp
│ ├── null_reactor.hpp
│ ├── thread.hpp
│ ├── scoped_ptr.hpp
│ ├── static_mutex.hpp
│ ├── gcc_hppa_fenced_block.hpp
│ ├── std_global.hpp
│ ├── buffer_resize_guard.hpp
│ ├── null_signal_blocker.hpp
│ ├── std_static_mutex.hpp
│ ├── reactor_op.hpp
│ ├── gcc_sync_fenced_block.hpp
│ ├── handler_invoke_helpers.hpp
│ ├── posix_mutex.hpp
│ ├── timer_queue_set.hpp
│ ├── base_from_completion_cond.hpp
│ ├── timer_queue_base.hpp
│ ├── win_tss_ptr.hpp
│ └── tss_ptr.hpp
│ ├── ssl.hpp
│ ├── ssl
│ ├── impl
│ │ └── src.hpp
│ ├── detail
│ │ ├── openssl_types.hpp
│ │ ├── shutdown_op.hpp
│ │ ├── handshake_op.hpp
│ │ ├── verify_callback.hpp
│ │ ├── password_callback.hpp
│ │ ├── write_op.hpp
│ │ └── read_op.hpp
│ ├── stream_base.hpp
│ ├── verify_context.hpp
│ └── verify_mode.hpp
│ ├── streambuf.hpp
│ ├── io_service.hpp
│ ├── basic_streambuf_fwd.hpp
│ ├── ip
│ ├── host_name.hpp
│ ├── resolver_query_base.hpp
│ ├── impl
│ │ ├── basic_endpoint.hpp
│ │ ├── host_name.ipp
│ │ ├── network_v6.hpp
│ │ ├── network_v4.hpp
│ │ ├── address.hpp
│ │ ├── address_v4.hpp
│ │ └── address_v6.hpp
│ ├── bad_address_cast.hpp
│ ├── unicast.hpp
│ └── v6_only.hpp
│ ├── deadline_timer.hpp
│ ├── steady_timer.hpp
│ ├── system_timer.hpp
│ ├── is_executor.hpp
│ ├── high_resolution_timer.hpp
│ ├── wait_traits.hpp
│ ├── handler_continuation_hook.hpp
│ ├── handler_type.hpp
│ ├── is_read_buffered.hpp
│ ├── is_write_buffered.hpp
│ └── experimental
│ └── detached.hpp
├── utils
└── AsioBase.h
├── conf
└── msnet.xml
├── src
├── Conf.h
├── flv
│ ├── FlvConn.h
│ ├── FlvSrv.h
│ ├── FlvWriter.h
│ └── FlvWriter.cpp
├── TcpBusinessMnger.h
├── Types.h
├── Publisher.h
├── TcpBusiness.h
├── TcpPoolServer.h
├── TcpConn.h
├── TcpBusinessMnger.cpp
├── Conf.cpp
└── NginxStat.h
├── Makefile
└── scripts
└── compile.mk
/msnet:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dontls/msnet/HEAD/msnet
--------------------------------------------------------------------------------
/librtmp/libRtmp.aps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dontls/msnet/HEAD/librtmp/libRtmp.aps
--------------------------------------------------------------------------------
/librtmp/libRtmp.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dontls/msnet/HEAD/librtmp/libRtmp.rc
--------------------------------------------------------------------------------
/librtmp/librtmp.so.0:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dontls/msnet/HEAD/librtmp/librtmp.so.0
--------------------------------------------------------------------------------
/librtmp/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dontls/msnet/HEAD/librtmp/resource.h
--------------------------------------------------------------------------------
/librtmp/testlibrtmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dontls/msnet/HEAD/librtmp/testlibrtmp
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "faac"]
2 | path = faac
3 | url = https://github.com/knik0/faac.git
4 | [submodule "inc"]
5 | path = inc
6 | url = https://github.com/dontls/inc.git
7 |
--------------------------------------------------------------------------------
/librtmp/libRtmp.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // See https://go.microsoft.com/fwlink/?LinkId=733558
3 | // for the documentation about the tasks.json format
4 | "version": "2.0.0",
5 | "tasks": [
6 | {
7 | "label": "shell",
8 | "type": "shell",
9 | "command": "make -j8"
10 | }
11 | ]
12 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ##### 3rd
2 | * librtmp
3 |
4 | * asio-1.12.2
5 |
6 | * g7xx https://www.soft-switch.org/downloads/spandsp/
7 |
8 | ##### build
9 |
10 | * clone submodule `git submodule update --init --recursive`
11 |
12 | * faac `./bootstrap && ./configure && make`
13 |
14 | ##### serve
15 |
16 | * httpflv: http://localhost:10600/live/livedsssssssss.flv
17 |
18 | * flv-h265 https://github.com/tsingsee/EasyPlayer.js
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Compiled Object files
5 | *.slo
6 | *.lo
7 | *.o
8 | *.obj
9 |
10 | # Precompiled Headers
11 | *.gch
12 | *.pch
13 |
14 | # Compiled Dynamic libraries
15 | *.so
16 | *.dylib
17 | *.dll
18 |
19 | # Fortran module files
20 | *.mod
21 | *.smod
22 |
23 | # Compiled Static libraries
24 | *.lai
25 | *.la
26 | *.a
27 | *.lib
28 |
29 | # Executables
30 | *.exe
31 | *.out
32 | *.app
33 |
34 | build/*
35 | .xmake/*
--------------------------------------------------------------------------------
/.clang-format:
--------------------------------------------------------------------------------
1 | # Run manually to reformat a file:
2 | # clang-format -i --style=file
3 | # find . -iname '*.cc' -o -iname '*.h' -o -iname '*.h.in' | xargs clang-format -i --style=file
4 | BasedOnStyle: Google
5 | DerivePointerAlignment: false
6 | SortIncludes: false
7 |
8 | # Public headers are in a different location in the internal Google repository.
9 | # Order them so that when imported to the authoritative repository they will be
10 | # in correct alphabetical order.
--------------------------------------------------------------------------------
/asio-1.12.2/asio/unyield.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // unyield.hpp
3 | // ~~~~~~~~~~~
4 | //
5 | // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 | //
7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 | //
10 |
11 | #ifdef reenter
12 | # undef reenter
13 | #endif
14 |
15 | #ifdef yield
16 | # undef yield
17 | #endif
18 |
19 | #ifdef fork
20 | # undef fork
21 | #endif
22 |
--------------------------------------------------------------------------------
/utils/AsioBase.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define ASIO_STANDALONE
4 | #define ASIO_HAS_STD_CHRONO
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | struct noncopyable {
11 | protected:
12 | noncopyable() {}
13 | virtual ~noncopyable() {}
14 |
15 | private:
16 | noncopyable(const noncopyable&) = delete;
17 | noncopyable& operator=(const noncopyable&) = delete;
18 | noncopyable(noncopyable&&) = delete;
19 | noncopyable& operator=(noncopyable&&) = delete;
20 | };
21 |
--------------------------------------------------------------------------------
/conf/msnet.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 172.16.50.219
6 |
7 | 8800
8 |
9 |
10 |
11 | 10
12 |
13 | 30
14 |
15 | 50
16 |
17 |
18 | 8899
19 |
20 |
21 |
--------------------------------------------------------------------------------
/asio-1.12.2/asio/yield.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // yield.hpp
3 | // ~~~~~~~~~
4 | //
5 | // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 | //
7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 | //
10 |
11 | #include "coroutine.hpp"
12 |
13 | #ifndef reenter
14 | # define reenter(c) ASIO_CORO_REENTER(c)
15 | #endif
16 |
17 | #ifndef yield
18 | # define yield ASIO_CORO_YIELD
19 | #endif
20 |
21 | #ifndef fork
22 | # define fork ASIO_CORO_FORK
23 | #endif
24 |
--------------------------------------------------------------------------------
/asio-1.12.2/asio/ts/io_context.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // ts/io_context.hpp
3 | // ~~~~~~~~~~~~~~~~~
4 | //
5 | // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 | //
7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 | //
10 |
11 | #ifndef ASIO_TS_IO_CONTEXT_HPP
12 | #define ASIO_TS_IO_CONTEXT_HPP
13 |
14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 | # pragma once
16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 |
18 | #include "asio/io_context.hpp"
19 |
20 | #endif // ASIO_TS_IO_CONTEXT_HPP
21 |
--------------------------------------------------------------------------------
/asio-1.12.2/asio/io_service_strand.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // io_service_strand.hpp
3 | // ~~~~~~~~~~~~~~~~~~~~~
4 | //
5 | // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 | //
7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 | //
10 |
11 | #ifndef ASIO_IO_SERVICE_STRAND_HPP
12 | #define ASIO_IO_SERVICE_STRAND_HPP
13 |
14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 | # pragma once
16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 |
18 | #include "asio/io_context_strand.hpp"
19 |
20 | #endif // ASIO_IO_SERVICE_STRAND_HPP
21 |
--------------------------------------------------------------------------------
/src/Conf.h:
--------------------------------------------------------------------------------
1 | #ifndef CONF_H
2 | #define CONF_H
3 |
4 | #include
5 |
6 | typedef struct NginxConifg {
7 | std::string ip;
8 | std::string stat_port;
9 | } NginxConifg_t;
10 |
11 | typedef struct DevConfig {
12 | int max_num;
13 | int auto_close_time;
14 | int bytes_out;
15 | } DevConfig_t;
16 |
17 | typedef struct ServerConfig {
18 | int port;
19 | } ServerConfig_t;
20 |
21 | typedef struct XmlConfig {
22 | NginxConifg_t nginx;
23 | DevConfig_t dev;
24 | ServerConfig_t server;
25 | } XmlConfig_t;
26 |
27 | bool XmlConfigInit(const char* xmlPath);
28 |
29 | struct XmlConfig* GetXmlConfig();
30 |
31 | std::string GetRtmpBaseUrl();
32 |
33 | #endif
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | APP-build := msnet
3 |
4 | # 头文件路径
5 | INCLUDES += -I ./
6 | INCLUDES += -I ./inc
7 | INCLUDES += -I ./asio-1.12.2
8 | INCLUDES += -I ./faac/include
9 | INCLUDES += -I ./utils
10 | INCLUDES += -I ./src
11 |
12 | LDFLAGS += ./librtmp/librtmp.a ./faac/libfaac/.libs/libfaac.a
13 |
14 | # LDFLAGS += -L/usr/local/lib -lavutil -lavformat -lavcodec
15 |
16 | ifeq (y, $(USE_SRS_LIBRTMP))
17 | CXXFLAGS += -DSRS_LIBRTMP
18 | DIRS += srs
19 | endif
20 | # 编译选项
21 | CXXFLAGS += $(INCLUDES)
22 |
23 | # 生成可执行程序链接库
24 | LDFLAGS += -ldl -lrt -pthread -Wl,-rpath=./
25 |
26 | # 源文件
27 | DIRS += src/g7xx src/flv src/rtmp src
28 | SRCS += Main.cpp
29 |
30 | -include scripts/compile.mk
--------------------------------------------------------------------------------
/asio-1.12.2/asio/experimental.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // experimental.hpp
3 | // ~~~~~~~~~~~~~~~~
4 | //
5 | // Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 | //
7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 | //
10 |
11 | #ifndef ASIO_EXPERIMENTAL_HPP
12 | #define ASIO_EXPERIMENTAL_HPP
13 |
14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 | # pragma once
16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 |
18 | #include "asio/experimental/co_spawn.hpp"
19 | #include "asio/experimental/detached.hpp"
20 | #include "asio/experimental/redirect_error.hpp"
21 |
22 | #endif // ASIO_EXPERIMENTAL_HPP
23 |
--------------------------------------------------------------------------------
/asio-1.12.2/asio/buffered_stream_fwd.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // buffered_stream_fwd.hpp
3 | // ~~~~~~~~~~~~~~~~~~~~~~~
4 | //
5 | // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 | //
7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 | //
10 |
11 | #ifndef ASIO_BUFFERED_STREAM_FWD_HPP
12 | #define ASIO_BUFFERED_STREAM_FWD_HPP
13 |
14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 | # pragma once
16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 |
18 | namespace asio {
19 |
20 | template
21 | class buffered_stream;
22 |
23 | } // namespace asio
24 |
25 | #endif // ASIO_BUFFERED_STREAM_FWD_HPP
26 |
--------------------------------------------------------------------------------
/asio-1.12.2/asio/ts/buffer.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // ts/buffer.hpp
3 | // ~~~~~~~~~~~~~
4 | //
5 | // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 | //
7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 | //
10 |
11 | #ifndef ASIO_TS_BUFFER_HPP
12 | #define ASIO_TS_BUFFER_HPP
13 |
14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 | # pragma once
16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 |
18 | #include "asio/buffer.hpp"
19 | #include "asio/completion_condition.hpp"
20 | #include "asio/read.hpp"
21 | #include "asio/write.hpp"
22 | #include "asio/read_until.hpp"
23 |
24 | #endif // ASIO_TS_BUFFER_HPP
25 |
--------------------------------------------------------------------------------
/src/flv/FlvConn.h:
--------------------------------------------------------------------------------
1 | #ifndef FLVCONNECTION_H
2 | #define FLVCONNECTION_H
3 |
4 | #include "AsioBase.h"
5 |
6 | class FlvConn : public std::enable_shared_from_this {
7 | private:
8 | asio::ip::tcp::socket _socket;
9 | char _buffer[BUFSIZ];
10 | unsigned long long _startTick;
11 | std::string _sessionId;
12 | bool bWaitKey_;
13 |
14 | public:
15 | FlvConn(asio::ip::tcp::socket socket);
16 | void start();
17 | void Write(char* data, size_t n, bool bmeta, std::string& aacspec);
18 |
19 | private:
20 | void doRead();
21 | void doWrite(const char* data, int len);
22 | void doClose();
23 | bool flvHTTPUrlParse(const char* request, int len);
24 | };
25 |
26 | typedef std::shared_ptr FlvConn_Ptr;
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/src/flv/FlvSrv.h:
--------------------------------------------------------------------------------
1 | #ifndef TCPFLVSRV_H
2 | #define TCPFLVSRV_H
3 |
4 | #include "FlvConn.h"
5 |
6 | class FlvServer : public asio::noncopyable {
7 | asio::ip::tcp::acceptor _acceptor;
8 |
9 | public:
10 | FlvServer(asio::io_context& ioCcontext, int port)
11 | : _acceptor(ioCcontext,
12 | asio::ip::tcp::endpoint(asio::ip::tcp::v4(), port)) {
13 | doAccept();
14 | }
15 |
16 | private:
17 | void doAccept() {
18 | _acceptor.async_accept(
19 | [this](std::error_code ec, asio::ip::tcp::socket socket) {
20 | if (!ec) {
21 | std::make_shared(std::move(socket))->start();
22 | }
23 | doAccept();
24 | });
25 | }
26 | };
27 |
28 | #endif // !TCPSRVFLV_H
29 |
--------------------------------------------------------------------------------
/asio-1.12.2/asio/version.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // version.hpp
3 | // ~~~~~~~~~~~
4 | //
5 | // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 | //
7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 | //
10 |
11 | #ifndef ASIO_VERSION_HPP
12 | #define ASIO_VERSION_HPP
13 |
14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 | # pragma once
16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 |
18 | // ASIO_VERSION % 100 is the sub-minor version
19 | // ASIO_VERSION / 100 % 1000 is the minor version
20 | // ASIO_VERSION / 100000 is the major version
21 | #define ASIO_VERSION 101202 // 1.12.2
22 |
23 | #endif // ASIO_VERSION_HPP
24 |
--------------------------------------------------------------------------------
/src/TcpBusinessMnger.h:
--------------------------------------------------------------------------------
1 | #ifndef TCP_BUSINESS_MNGER_H
2 | #define TCP_BUSINESS_MNGER_H
3 |
4 | #include "TcpBusiness.h"
5 | #include