Compare commits

..

No commits in common. "4c90a1a95ba8b90ecf873653bd7944cb2ef0a52d" and "fdbf77d46d2d9dec1f305015481791fd9d43116b" have entirely different histories.

4 changed files with 18 additions and 15 deletions

@ -1 +1 @@
Subproject commit 08c094ea14f259ecf0c356e6243cb47ee96ce292 Subproject commit 46231014e2a7ec1903d4a37e96222481ecc779d8

View File

@ -25,8 +25,13 @@ RUN apt-get update && \
ca-certificates \ ca-certificates \
tzdata \ tzdata \
libssl-dev \ libssl-dev \
libmysqlclient-dev \
libx264-dev \
libfaac-dev \
gcc \ gcc \
g++ \ g++ \
libavcodec-dev libavutil-dev libswscale-dev libresample-dev \
libsdl-dev libusrsctp-dev \
gdb && \ gdb && \
apt-get autoremove -y && \ apt-get autoremove -y && \
apt-get clean -y && \ apt-get clean -y && \
@ -64,9 +69,13 @@ RUN apt-get update && \
tzdata \ tzdata \
curl \ curl \
libssl-dev \ libssl-dev \
libx264-dev \
libfaac-dev \
ffmpeg \ ffmpeg \
gcc \ gcc \
g++ \ g++ \
libavcodec-dev libavutil-dev libswscale-dev libresample-dev \
libsdl-dev libusrsctp-dev \
gdb && \ gdb && \
apt-get autoremove -y && \ apt-get autoremove -y && \
apt-get clean -y && \ apt-get clean -y && \

View File

@ -122,17 +122,12 @@ private:
std::list<std::pair<uint64_t, Frame::Ptr>> _cache; std::list<std::pair<uint64_t, Frame::Ptr>> _cache;
}; };
std::shared_ptr<MediaSinkInterface> MultiMediaSourceMuxer::makeRecorder(MediaSource &sender, Recorder::type type) { static std::shared_ptr<MediaSinkInterface> makeRecorder(MediaSource &sender, const vector<Track::Ptr> &tracks, Recorder::type type, const ProtocolOption &option){
auto recorder = Recorder::createRecorder(type, sender.getMediaTuple(), _option); auto recorder = Recorder::createRecorder(type, sender.getMediaTuple(), option);
for (auto &track : getTracks()) { for (auto &track : tracks) {
recorder->addTrack(track); recorder->addTrack(track);
} }
recorder->addTrackCompleted(); recorder->addTrackCompleted();
if (_ring) {
_ring->flushGop([&](const Frame::Ptr &frame) {
recorder->inputFrame(frame);
});
}
return recorder; return recorder;
} }
@ -310,7 +305,7 @@ bool MultiMediaSourceMuxer::setupRecord(MediaSource &sender, Recorder::type type
// 开始录制 [AUTO-TRANSLATED:36d99250] // 开始录制 [AUTO-TRANSLATED:36d99250]
// Start recording // Start recording
_option.hls_save_path = custom_path; _option.hls_save_path = custom_path;
auto hls = dynamic_pointer_cast<HlsRecorder>(makeRecorder(sender, type)); auto hls = dynamic_pointer_cast<HlsRecorder>(makeRecorder(sender, getTracks(), type, _option));
if (hls) { if (hls) {
// 设置HlsMediaSource的事件监听器 [AUTO-TRANSLATED:69990c92] // 设置HlsMediaSource的事件监听器 [AUTO-TRANSLATED:69990c92]
// Set the event listener for HlsMediaSource // Set the event listener for HlsMediaSource
@ -330,7 +325,7 @@ bool MultiMediaSourceMuxer::setupRecord(MediaSource &sender, Recorder::type type
// Start recording // Start recording
_option.mp4_save_path = custom_path; _option.mp4_save_path = custom_path;
_option.mp4_max_second = max_second; _option.mp4_max_second = max_second;
_mp4 = makeRecorder(sender, type); _mp4 = makeRecorder(sender, getTracks(), type, _option);
} else if (!start && _mp4) { } else if (!start && _mp4) {
// 停止录制 [AUTO-TRANSLATED:3dee9292] // 停止录制 [AUTO-TRANSLATED:3dee9292]
// Stop recording // Stop recording
@ -343,7 +338,7 @@ bool MultiMediaSourceMuxer::setupRecord(MediaSource &sender, Recorder::type type
// 开始录制 [AUTO-TRANSLATED:36d99250] // 开始录制 [AUTO-TRANSLATED:36d99250]
// Start recording // Start recording
_option.hls_save_path = custom_path; _option.hls_save_path = custom_path;
auto hls = dynamic_pointer_cast<HlsFMP4Recorder>(makeRecorder(sender, type)); auto hls = dynamic_pointer_cast<HlsFMP4Recorder>(makeRecorder(sender, getTracks(), type, _option));
if (hls) { if (hls) {
// 设置HlsMediaSource的事件监听器 [AUTO-TRANSLATED:69990c92] // 设置HlsMediaSource的事件监听器 [AUTO-TRANSLATED:69990c92]
// Set the event listener for HlsMediaSource // Set the event listener for HlsMediaSource
@ -359,7 +354,7 @@ bool MultiMediaSourceMuxer::setupRecord(MediaSource &sender, Recorder::type type
} }
case Recorder::type_fmp4: { case Recorder::type_fmp4: {
if (start && !_fmp4) { if (start && !_fmp4) {
auto fmp4 = dynamic_pointer_cast<FMP4MediaSourceMuxer>(makeRecorder(sender, type)); auto fmp4 = dynamic_pointer_cast<FMP4MediaSourceMuxer>(makeRecorder(sender, getTracks(), type, _option));
if (fmp4) { if (fmp4) {
fmp4->setListener(shared_from_this()); fmp4->setListener(shared_from_this());
} }
@ -371,7 +366,7 @@ bool MultiMediaSourceMuxer::setupRecord(MediaSource &sender, Recorder::type type
} }
case Recorder::type_ts: { case Recorder::type_ts: {
if (start && !_ts) { if (start && !_ts) {
auto ts = dynamic_pointer_cast<TSMediaSourceMuxer>(makeRecorder(sender, type)); auto ts = dynamic_pointer_cast<TSMediaSourceMuxer>(makeRecorder(sender, getTracks(), type, _option));
if (ts) { if (ts) {
ts->setListener(shared_from_this()); ts->setListener(shared_from_this());
} }

View File

@ -232,7 +232,6 @@ protected:
private: private:
void createGopCacheIfNeed(); void createGopCacheIfNeed();
std::shared_ptr<MediaSinkInterface> makeRecorder(MediaSource &sender, Recorder::type type);
private: private:
bool _is_enable = false; bool _is_enable = false;