2018-10-27 22:40:44 +08:00
|
|
|
|
/*
|
2020-04-04 20:30:09 +08:00
|
|
|
|
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
2018-10-27 22:40:44 +08:00
|
|
|
|
*
|
2021-01-17 18:31:50 +08:00
|
|
|
|
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
|
2018-10-27 22:40:44 +08:00
|
|
|
|
*
|
2020-04-04 20:30:09 +08:00
|
|
|
|
* Use of this source code is governed by MIT license that can be found in the
|
|
|
|
|
|
* LICENSE file in the root of the source tree. All contributing project authors
|
|
|
|
|
|
* may be found in the AUTHORS file in the root of the source tree.
|
2018-10-27 22:40:44 +08:00
|
|
|
|
*/
|
2020-04-04 20:30:09 +08:00
|
|
|
|
|
2018-10-27 22:40:44 +08:00
|
|
|
|
#include "MediaSink.h"
|
2021-09-27 13:12:53 +08:00
|
|
|
|
#include "Extension/AAC.h"
|
2018-10-27 22:40:44 +08:00
|
|
|
|
|
2018-11-17 15:25:33 +08:00
|
|
|
|
//最多等待未初始化的Track 10秒,超时之后会忽略未初始化的Track
|
2021-04-26 14:58:06 +08:00
|
|
|
|
static size_t constexpr kMaxWaitReadyMS= 10000;
|
2020-01-13 15:48:55 +08:00
|
|
|
|
|
2021-04-20 17:32:40 +08:00
|
|
|
|
//如果直播流只有单Track,最多等待3秒,超时后未收到其他Track的数据,则认为是单Track
|
2021-04-26 14:58:06 +08:00
|
|
|
|
static size_t constexpr kMaxAddTrackMS = 3000;
|
|
|
|
|
|
|
|
|
|
|
|
//如果track未就绪,我们先缓存帧数据,但是有最大个数限制(100帧时大约4秒),防止内存溢出
|
|
|
|
|
|
static size_t constexpr kMaxUnreadyFrame = 100;
|
2018-10-27 22:40:44 +08:00
|
|
|
|
|
|
|
|
|
|
namespace mediakit{
|
|
|
|
|
|
|
2021-09-27 13:12:53 +08:00
|
|
|
|
bool MediaSink::addTrack(const Track::Ptr &track_in) {
|
2021-05-22 10:17:52 +08:00
|
|
|
|
GET_CONFIG(bool, enabel_audio, General::kEnableAudio);
|
2021-09-14 16:27:11 +08:00
|
|
|
|
if (!enabel_audio) {
|
|
|
|
|
|
//关闭音频时,加快单视频流注册速度
|
|
|
|
|
|
_max_track_size = 1;
|
|
|
|
|
|
if (track_in->getTrackType() == TrackAudio) {
|
|
|
|
|
|
//音频被全局忽略
|
2021-09-27 13:12:53 +08:00
|
|
|
|
return false;
|
2021-09-14 16:27:11 +08:00
|
|
|
|
}
|
2021-09-27 13:20:34 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
//是否添加静音音频
|
|
|
|
|
|
GET_CONFIG(bool, addMuteAudio, General::kAddMuteAudio);
|
|
|
|
|
|
if (addMuteAudio && track_in->getTrackType() == TrackVideo) {
|
|
|
|
|
|
addMuteAudioTrack();
|
|
|
|
|
|
}
|
2021-05-22 10:17:52 +08:00
|
|
|
|
}
|
2018-10-28 01:04:18 +08:00
|
|
|
|
lock_guard<recursive_mutex> lck(_mtx);
|
2020-10-20 10:21:35 +08:00
|
|
|
|
if (_all_track_ready) {
|
|
|
|
|
|
WarnL << "all track is ready, add this track too late!";
|
2021-09-27 13:12:53 +08:00
|
|
|
|
return false;
|
2020-10-20 10:21:35 +08:00
|
|
|
|
}
|
2019-10-11 16:51:10 +08:00
|
|
|
|
//克隆Track,只拷贝其数据,不拷贝其数据转发关系
|
2018-10-27 22:40:44 +08:00
|
|
|
|
auto track = track_in->clone();
|
2021-09-27 13:20:34 +08:00
|
|
|
|
auto track_type = track->getTrackType();
|
2021-09-27 14:12:11 +08:00
|
|
|
|
if (track_type == TrackAudio) {
|
|
|
|
|
|
//确保添加非静音音频track时,取消之前的静音音频track
|
|
|
|
|
|
_mute_audio_maker = nullptr;
|
|
|
|
|
|
}
|
2021-09-27 13:20:34 +08:00
|
|
|
|
_track_map[track_type] = track;
|
|
|
|
|
|
_track_ready_callback[track_type] = [this, track]() {
|
2018-10-27 22:40:44 +08:00
|
|
|
|
onTrackReady(track);
|
|
|
|
|
|
};
|
2020-01-13 15:48:55 +08:00
|
|
|
|
_ticker.resetTime();
|
2019-10-12 10:29:40 +08:00
|
|
|
|
|
2020-01-13 15:48:55 +08:00
|
|
|
|
track->addDelegate(std::make_shared<FrameWriterInterfaceHelper>([this](const Frame::Ptr &frame) {
|
2020-04-26 15:19:32 +08:00
|
|
|
|
if (_all_track_ready) {
|
2021-09-27 13:12:53 +08:00
|
|
|
|
return onTrackFrame(frame);
|
|
|
|
|
|
}
|
2021-09-27 13:20:34 +08:00
|
|
|
|
auto &frame_unread = _frame_unread[frame->getTrackType()];
|
2021-09-27 13:12:53 +08:00
|
|
|
|
if (frame_unread.size() > kMaxUnreadyFrame) {
|
|
|
|
|
|
//未就绪的的track,不能缓存太多的帧,否则可能内存溢出
|
|
|
|
|
|
frame_unread.clear();
|
|
|
|
|
|
WarnL << "cached frame of unready track(" << frame->getCodecName() << ") is too much, now cleared";
|
2020-04-17 17:47:10 +08:00
|
|
|
|
}
|
2021-09-27 13:12:53 +08:00
|
|
|
|
//还有Track未就绪,先缓存之
|
|
|
|
|
|
frame_unread.emplace_back(Frame::getCacheAbleFrame(frame));
|
|
|
|
|
|
return true;
|
2019-10-12 10:29:40 +08:00
|
|
|
|
}));
|
2021-09-27 13:12:53 +08:00
|
|
|
|
return true;
|
2018-10-27 22:40:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-10-11 16:51:10 +08:00
|
|
|
|
void MediaSink::resetTracks() {
|
2019-10-11 17:51:46 +08:00
|
|
|
|
lock_guard<recursive_mutex> lck(_mtx);
|
2020-04-26 15:19:32 +08:00
|
|
|
|
_all_track_ready = false;
|
2019-10-11 16:51:10 +08:00
|
|
|
|
_track_map.clear();
|
2020-04-26 15:19:32 +08:00
|
|
|
|
_track_ready_callback.clear();
|
2019-10-11 16:51:10 +08:00
|
|
|
|
_ticker.resetTime();
|
2020-02-25 14:59:40 +08:00
|
|
|
|
_max_track_size = 2;
|
2020-04-26 15:19:32 +08:00
|
|
|
|
_frame_unread.clear();
|
2019-10-11 16:51:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-09-27 13:12:53 +08:00
|
|
|
|
bool MediaSink::inputFrame(const Frame::Ptr &frame) {
|
2018-10-28 01:04:18 +08:00
|
|
|
|
lock_guard<recursive_mutex> lck(_mtx);
|
2021-09-27 13:20:34 +08:00
|
|
|
|
auto it = _track_map.find(frame->getTrackType());
|
2018-10-27 22:40:44 +08:00
|
|
|
|
if (it == _track_map.end()) {
|
2021-09-27 13:12:53 +08:00
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
auto ret = it->second->inputFrame(frame);
|
|
|
|
|
|
if (_mute_audio_maker && frame->getTrackType() == TrackVideo) {
|
|
|
|
|
|
//视频驱动产生静音音频
|
|
|
|
|
|
_mute_audio_maker->inputFrame(frame);
|
2018-10-27 22:40:44 +08:00
|
|
|
|
}
|
2020-04-26 15:19:32 +08:00
|
|
|
|
checkTrackIfReady(nullptr);
|
2021-09-27 13:12:53 +08:00
|
|
|
|
return ret;
|
2020-02-27 12:31:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MediaSink::checkTrackIfReady_l(const Track::Ptr &track){
|
|
|
|
|
|
//Track由未就绪状态转换成就绪状态,我们就触发onTrackReady回调
|
2021-09-27 13:20:34 +08:00
|
|
|
|
auto it_callback = _track_ready_callback.find(track->getTrackType());
|
2020-04-26 15:19:32 +08:00
|
|
|
|
if (it_callback != _track_ready_callback.end() && track->ready()) {
|
2020-02-27 12:31:57 +08:00
|
|
|
|
it_callback->second();
|
2020-04-26 15:19:32 +08:00
|
|
|
|
_track_ready_callback.erase(it_callback);
|
2020-02-27 12:31:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2018-11-17 15:25:33 +08:00
|
|
|
|
|
2020-02-27 12:31:57 +08:00
|
|
|
|
void MediaSink::checkTrackIfReady(const Track::Ptr &track){
|
2020-04-26 15:19:32 +08:00
|
|
|
|
if (!_all_track_ready && !_track_ready_callback.empty()) {
|
2020-02-27 12:31:57 +08:00
|
|
|
|
if (track) {
|
|
|
|
|
|
checkTrackIfReady_l(track);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (auto &pr : _track_map) {
|
|
|
|
|
|
checkTrackIfReady_l(pr.second);
|
|
|
|
|
|
}
|
2018-10-27 22:40:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-26 15:19:32 +08:00
|
|
|
|
if(!_all_track_ready){
|
2021-04-26 14:58:06 +08:00
|
|
|
|
if(_ticker.elapsedTime() > kMaxWaitReadyMS){
|
2020-01-13 15:48:55 +08:00
|
|
|
|
//如果超过规定时间,那么不再等待并忽略未准备好的Track
|
2020-02-25 14:59:40 +08:00
|
|
|
|
emitAllTrackReady();
|
2020-01-13 15:48:55 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-26 15:19:32 +08:00
|
|
|
|
if(!_track_ready_callback.empty()){
|
2020-01-13 15:48:55 +08:00
|
|
|
|
//在超时时间内,如果存在未准备好的Track,那么继续等待
|
|
|
|
|
|
return;
|
2018-11-17 15:25:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-25 14:59:40 +08:00
|
|
|
|
if(_track_map.size() == _max_track_size){
|
2020-01-13 15:48:55 +08:00
|
|
|
|
//如果已经添加了音视频Track,并且不存在未准备好的Track,那么说明所有Track都准备好了
|
2020-02-25 14:59:40 +08:00
|
|
|
|
emitAllTrackReady();
|
2020-01-13 15:48:55 +08:00
|
|
|
|
return;
|
2018-11-17 15:25:33 +08:00
|
|
|
|
}
|
2020-01-13 15:48:55 +08:00
|
|
|
|
|
2021-04-26 14:58:06 +08:00
|
|
|
|
if(_track_map.size() == 1 && _ticker.elapsedTime() > kMaxAddTrackMS){
|
2020-01-13 15:48:55 +08:00
|
|
|
|
//如果只有一个Track,那么在该Track添加后,我们最多还等待若干时间(可能后面还会添加Track)
|
2020-02-25 14:59:40 +08:00
|
|
|
|
emitAllTrackReady();
|
2020-01-13 15:48:55 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-02-25 14:59:40 +08:00
|
|
|
|
void MediaSink::addTrackCompleted(){
|
2020-04-26 15:19:32 +08:00
|
|
|
|
lock_guard<recursive_mutex> lck(_mtx);
|
|
|
|
|
|
_max_track_size = _track_map.size();
|
2020-02-27 12:31:57 +08:00
|
|
|
|
checkTrackIfReady(nullptr);
|
2020-02-25 14:59:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MediaSink::emitAllTrackReady() {
|
2020-04-26 15:19:32 +08:00
|
|
|
|
if (_all_track_ready) {
|
2020-01-22 19:09:53 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-17 17:47:10 +08:00
|
|
|
|
DebugL << "all track ready use " << _ticker.elapsedTime() << "ms";
|
2020-04-26 15:19:32 +08:00
|
|
|
|
if (!_track_ready_callback.empty()) {
|
2020-01-13 15:48:55 +08:00
|
|
|
|
//这是超时强制忽略未准备好的Track
|
2020-04-26 15:19:32 +08:00
|
|
|
|
_track_ready_callback.clear();
|
2020-01-13 15:48:55 +08:00
|
|
|
|
//移除未准备好的Track
|
2020-01-22 19:09:53 +08:00
|
|
|
|
for (auto it = _track_map.begin(); it != _track_map.end();) {
|
|
|
|
|
|
if (!it->second->ready()) {
|
2020-04-18 18:46:20 +08:00
|
|
|
|
WarnL << "track not ready for a long time, ignored: " << it->second->getCodecName();
|
2020-01-13 15:48:55 +08:00
|
|
|
|
it = _track_map.erase(it);
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
++it;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-01-22 19:09:53 +08:00
|
|
|
|
if (!_track_map.empty()) {
|
2020-01-13 15:48:55 +08:00
|
|
|
|
//最少有一个有效的Track
|
2020-04-26 15:19:32 +08:00
|
|
|
|
_all_track_ready = true;
|
2020-01-13 15:48:55 +08:00
|
|
|
|
onAllTrackReady();
|
2020-04-26 15:19:32 +08:00
|
|
|
|
|
|
|
|
|
|
//全部Track就绪,我们一次性把之前的帧输出
|
|
|
|
|
|
for(auto &pr : _frame_unread){
|
|
|
|
|
|
if (_track_map.find(pr.first) == _track_map.end()) {
|
|
|
|
|
|
//该Track已经被移除
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
pr.second.for_each([&](const Frame::Ptr &frame) {
|
|
|
|
|
|
onTrackFrame(frame);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
_frame_unread.clear();
|
2018-10-27 22:40:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-12-03 12:32:57 +08:00
|
|
|
|
vector<Track::Ptr> MediaSink::getTracks(bool trackReady) const{
|
|
|
|
|
|
vector<Track::Ptr> ret;
|
2018-10-28 01:04:18 +08:00
|
|
|
|
lock_guard<recursive_mutex> lck(_mtx);
|
2018-10-28 00:15:27 +08:00
|
|
|
|
for (auto &pr : _track_map){
|
2019-12-03 12:32:57 +08:00
|
|
|
|
if(trackReady && !pr.second->ready()){
|
|
|
|
|
|
continue;
|
2018-10-28 00:15:27 +08:00
|
|
|
|
}
|
2019-12-03 12:32:57 +08:00
|
|
|
|
ret.emplace_back(pr.second);
|
2018-10-28 00:15:27 +08:00
|
|
|
|
}
|
2020-09-21 14:32:56 +08:00
|
|
|
|
return ret;
|
2018-10-28 00:15:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-09-27 13:12:53 +08:00
|
|
|
|
class FrameFromStaticPtr : public FrameFromPtr {
|
|
|
|
|
|
public:
|
|
|
|
|
|
template<typename ... ARGS>
|
|
|
|
|
|
FrameFromStaticPtr(ARGS &&...args) : FrameFromPtr(std::forward<ARGS>(args)...) {};
|
|
|
|
|
|
~FrameFromStaticPtr() override = default;
|
|
|
|
|
|
|
|
|
|
|
|
bool cacheAble() const override {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t s_mute_adts[] = {0xff, 0xf1, 0x6c, 0x40, 0x2d, 0x3f, 0xfc, 0x00, 0xe0, 0x34, 0x20, 0xad, 0xf2, 0x3f, 0xb5, 0xdd,
|
|
|
|
|
|
0x73, 0xac, 0xbd, 0xca, 0xd7, 0x7d, 0x4a, 0x13, 0x2d, 0x2e, 0xa2, 0x62, 0x02, 0x70, 0x3c, 0x1c,
|
|
|
|
|
|
0xc5, 0x63, 0x55, 0x69, 0x94, 0xb5, 0x8d, 0x70, 0xd7, 0x24, 0x6a, 0x9e, 0x2e, 0x86, 0x24, 0xea,
|
|
|
|
|
|
0x4f, 0xd4, 0xf8, 0x10, 0x53, 0xa5, 0x4a, 0xb2, 0x9a, 0xf0, 0xa1, 0x4f, 0x2f, 0x66, 0xf9, 0xd3,
|
|
|
|
|
|
0x8c, 0xa6, 0x97, 0xd5, 0x84, 0xac, 0x09, 0x25, 0x98, 0x0b, 0x1d, 0x77, 0x04, 0xb8, 0x55, 0x49,
|
|
|
|
|
|
0x85, 0x27, 0x06, 0x23, 0x58, 0xcb, 0x22, 0xc3, 0x20, 0x3a, 0x12, 0x09, 0x48, 0x24, 0x86, 0x76,
|
|
|
|
|
|
0x95, 0xe3, 0x45, 0x61, 0x43, 0x06, 0x6b, 0x4a, 0x61, 0x14, 0x24, 0xa9, 0x16, 0xe0, 0x97, 0x34,
|
|
|
|
|
|
0xb6, 0x58, 0xa4, 0x38, 0x34, 0x90, 0x19, 0x5d, 0x00, 0x19, 0x4a, 0xc2, 0x80, 0x4b, 0xdc, 0xb7,
|
|
|
|
|
|
0x00, 0x18, 0x12, 0x3d, 0xd9, 0x93, 0xee, 0x74, 0x13, 0x95, 0xad, 0x0b, 0x59, 0x51, 0x0e, 0x99,
|
|
|
|
|
|
0xdf, 0x49, 0x98, 0xde, 0xa9, 0x48, 0x4b, 0xa5, 0xfb, 0xe8, 0x79, 0xc9, 0xe2, 0xd9, 0x60, 0xa5,
|
|
|
|
|
|
0xbe, 0x74, 0xa6, 0x6b, 0x72, 0x0e, 0xe3, 0x7b, 0x28, 0xb3, 0x0e, 0x52, 0xcc, 0xf6, 0x3d, 0x39,
|
|
|
|
|
|
0xb7, 0x7e, 0xbb, 0xf0, 0xc8, 0xce, 0x5c, 0x72, 0xb2, 0x89, 0x60, 0x33, 0x7b, 0xc5, 0xda, 0x49,
|
|
|
|
|
|
0x1a, 0xda, 0x33, 0xba, 0x97, 0x9e, 0xa8, 0x1b, 0x6d, 0x5a, 0x77, 0xb6, 0xf1, 0x69, 0x5a, 0xd1,
|
|
|
|
|
|
0xbd, 0x84, 0xd5, 0x4e, 0x58, 0xa8, 0x5e, 0x8a, 0xa0, 0xc2, 0xc9, 0x22, 0xd9, 0xa5, 0x53, 0x11,
|
|
|
|
|
|
0x18, 0xc8, 0x3a, 0x39, 0xcf, 0x3f, 0x57, 0xb6, 0x45, 0x19, 0x1e, 0x8a, 0x71, 0xa4, 0x46, 0x27,
|
|
|
|
|
|
0x9e, 0xe9, 0xa4, 0x86, 0xdd, 0x14, 0xd9, 0x4d, 0xe3, 0x71, 0xe3, 0x26, 0xda, 0xaa, 0x17, 0xb4,
|
|
|
|
|
|
0xac, 0xe1, 0x09, 0xc1, 0x0d, 0x75, 0xba, 0x53, 0x0a, 0x37, 0x8b, 0xac, 0x37, 0x39, 0x41, 0x27,
|
|
|
|
|
|
0x6a, 0xf0, 0xe9, 0xb4, 0xc2, 0xac, 0xb0, 0x39, 0x73, 0x17, 0x64, 0x95, 0xf4, 0xdc, 0x33, 0xbb,
|
|
|
|
|
|
0x84, 0x94, 0x3e, 0xf8, 0x65, 0x71, 0x60, 0x7b, 0xd4, 0x5f, 0x27, 0x79, 0x95, 0x6a, 0xba, 0x76,
|
|
|
|
|
|
0xa6, 0xa5, 0x9a, 0xec, 0xae, 0x55, 0x3a, 0x27, 0x48, 0x23, 0xcf, 0x5c, 0x4d, 0xbc, 0x0b, 0x35,
|
|
|
|
|
|
0x5c, 0xa7, 0x17, 0xcf, 0x34, 0x57, 0xc9, 0x58, 0xc5, 0x20, 0x09, 0xee, 0xa5, 0xf2, 0x9c, 0x6c,
|
|
|
|
|
|
0x39, 0x1a, 0x77, 0x92, 0x9b, 0xff, 0xc6, 0xae, 0xf8, 0x36, 0xba, 0xa8, 0xaa, 0x6b, 0x1e, 0x8c,
|
|
|
|
|
|
0xc5, 0x97, 0x39, 0x6a, 0xb8, 0xa2, 0x55, 0xa8, 0xf8};
|
|
|
|
|
|
|
|
|
|
|
|
#define MUTE_ADTS_DATA s_mute_adts
|
|
|
|
|
|
#define MUTE_ADTS_DATA_LEN sizeof(s_mute_adts)
|
|
|
|
|
|
#define MUTE_ADTS_DATA_MS 130
|
|
|
|
|
|
|
|
|
|
|
|
bool MuteAudioMaker::inputFrame(const Frame::Ptr &frame) {
|
|
|
|
|
|
if (frame->getTrackType() == TrackVideo) {
|
|
|
|
|
|
auto audio_idx = frame->dts() / MUTE_ADTS_DATA_MS;
|
|
|
|
|
|
if (_audio_idx != audio_idx) {
|
|
|
|
|
|
_audio_idx = audio_idx;
|
|
|
|
|
|
auto aacFrame = std::make_shared<FrameFromStaticPtr>(CodecAAC, (char *) MUTE_ADTS_DATA, MUTE_ADTS_DATA_LEN,
|
|
|
|
|
|
_audio_idx * MUTE_ADTS_DATA_MS, 0, ADTS_HEADER_LEN);
|
|
|
|
|
|
return FrameDispatcher::inputFrame(aacFrame);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MediaSink::addMuteAudioTrack() {
|
|
|
|
|
|
if (getTrack(TrackAudio, false)) {
|
|
|
|
|
|
WarnL << "audio track already existed";
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (addTrack(std::make_shared<AACTrack>())) {
|
|
|
|
|
|
_mute_audio_maker = std::make_shared<MuteAudioMaker>();
|
|
|
|
|
|
_mute_audio_maker->addDelegate(std::make_shared<FrameWriterInterfaceHelper>([this](const Frame::Ptr &frame) {
|
|
|
|
|
|
return inputFrame(frame);
|
|
|
|
|
|
}));
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-10-27 22:40:44 +08:00
|
|
|
|
|
|
|
|
|
|
}//namespace mediakit
|