mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
mp4录制支持作为观看者参与播放人数统计 (#1880)
This commit is contained in:
parent
c19fa29e75
commit
30984d2076
@ -238,6 +238,8 @@ sampleMS=500
|
||||
fastStart=0
|
||||
#MP4点播(rtsp/rtmp/http-flv/ws-flv)是否循环播放文件
|
||||
fileRepeat=0
|
||||
#MP4录制是否当做播放器参与播放人数统计
|
||||
mp4_as_player=0
|
||||
|
||||
[rtmp]
|
||||
#rtmp必须在此时间内完成握手,否则服务器会断开链接,单位秒
|
||||
|
@ -966,6 +966,7 @@ void installWebApi() {
|
||||
ProtocolOption option;
|
||||
getArgsValue(allArgs, "enable_hls", option.enable_hls);
|
||||
getArgsValue(allArgs, "enable_mp4", option.enable_mp4);
|
||||
getArgsValue(allArgs, "mp4_as_player", option.mp4_as_player);
|
||||
getArgsValue(allArgs, "enable_rtsp", option.enable_rtsp);
|
||||
getArgsValue(allArgs, "enable_rtmp", option.enable_rtmp);
|
||||
getArgsValue(allArgs, "enable_ts", option.enable_ts);
|
||||
|
@ -348,6 +348,9 @@ void installWebHook(){
|
||||
if (obj.isMember("continue_push_ms")) {
|
||||
option.continue_push_ms = obj["continue_push_ms"].asUInt();
|
||||
}
|
||||
if (obj.isMember("mp4_as_player")) {
|
||||
option.mp4_as_player = obj["mp4_as_player"].asBool();
|
||||
}
|
||||
invoker(err, option);
|
||||
} else {
|
||||
//推流鉴权失败
|
||||
|
@ -26,14 +26,15 @@ ProtocolOption::ProtocolOption() {
|
||||
GET_CONFIG(bool, s_to_mp4, General::kPublishToMP4);
|
||||
GET_CONFIG(bool, s_enabel_audio, General::kEnableAudio);
|
||||
GET_CONFIG(bool, s_add_mute_audio, General::kAddMuteAudio);
|
||||
GET_CONFIG(bool, s_mp4_as_player, Record::kMP4AsPlayer);
|
||||
GET_CONFIG(uint32_t, s_continue_push_ms, General::kContinuePushMS);
|
||||
|
||||
|
||||
enable_hls = s_to_hls;
|
||||
enable_mp4 = s_to_mp4;
|
||||
enable_audio = s_enabel_audio;
|
||||
add_mute_audio = s_add_mute_audio;
|
||||
continue_push_ms = s_continue_push_ms;
|
||||
mp4_as_player = s_mp4_as_player;
|
||||
}
|
||||
|
||||
static std::shared_ptr<MediaSinkInterface> makeRecorder(MediaSource &sender, const vector<Track::Ptr> &tracks, Recorder::type type, const string &custom_path, size_t max_second){
|
||||
@ -75,6 +76,7 @@ static string getTrackInfoStr(const TrackSource *track_src){
|
||||
}
|
||||
|
||||
MultiMediaSourceMuxer::MultiMediaSourceMuxer(const string &vhost, const string &app, const string &stream, float dur_sec, const ProtocolOption &option) {
|
||||
_option = option;
|
||||
_get_origin_url = [this, vhost, app, stream]() {
|
||||
auto ret = getOriginUrl(*MediaSource::NullMediaSource);
|
||||
if (!ret.empty()) {
|
||||
@ -146,6 +148,7 @@ int MultiMediaSourceMuxer::totalReaderCount() const {
|
||||
#if defined(ENABLE_MP4)
|
||||
(_fmp4 ? _fmp4->readerCount() : 0) +
|
||||
#endif
|
||||
(_mp4 ? _option.mp4_as_player : 0) +
|
||||
(hls ? hls->readerCount() : 0);
|
||||
|
||||
#if defined(ENABLE_RTPPROXY)
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
bool enable_hls = false;
|
||||
//是否开启MP4录制
|
||||
bool enable_mp4 = false;
|
||||
//是否将mp4录制当做观看者
|
||||
bool mp4_as_player = false;
|
||||
//是否开启转换为rtsp/webrtc
|
||||
bool enable_rtsp = true;
|
||||
//是否开启转换为rtmp/flv
|
||||
@ -175,6 +177,7 @@ protected:
|
||||
|
||||
private:
|
||||
bool _is_enable = false;
|
||||
ProtocolOption _option;
|
||||
toolkit::Ticker _last_check;
|
||||
Stamp _stamp[2];
|
||||
std::weak_ptr<Listener> _track_listener;
|
||||
|
@ -238,6 +238,7 @@ const string kFilePath = RECORD_FIELD "filePath";
|
||||
const string kFileBufSize = RECORD_FIELD "fileBufSize";
|
||||
const string kFastStart = RECORD_FIELD "fastStart";
|
||||
const string kFileRepeat = RECORD_FIELD "fileRepeat";
|
||||
const string kMP4AsPlayer = RECORD_FIELD "mp4_as_player";
|
||||
|
||||
static onceToken token([]() {
|
||||
mINI::Instance()[kAppName] = "record";
|
||||
@ -247,6 +248,7 @@ static onceToken token([]() {
|
||||
mINI::Instance()[kFileBufSize] = 64 * 1024;
|
||||
mINI::Instance()[kFastStart] = false;
|
||||
mINI::Instance()[kFileRepeat] = false;
|
||||
mINI::Instance()[kMP4AsPlayer] = false;
|
||||
});
|
||||
} // namespace Record
|
||||
|
||||
|
@ -295,6 +295,8 @@ extern const std::string kFileBufSize;
|
||||
extern const std::string kFastStart;
|
||||
// mp4文件是否重头循环读取
|
||||
extern const std::string kFileRepeat;
|
||||
//MP4录制是否当做播放器参与播放人数统计
|
||||
extern const std::string kMP4AsPlayer;
|
||||
} // namespace Record
|
||||
|
||||
////////////HLS相关配置///////////
|
||||
|
Loading…
Reference in New Issue
Block a user