解决合并冲突

This commit is contained in:
monktan
2020-11-24 14:49:21 +08:00
11 changed files with 100 additions and 31 deletions

View File

@@ -16,6 +16,13 @@
#include "Extension/G711.h"
#include "Extension/H264.h"
#include "Extension/H265.h"
#ifdef ENABLE_FAAC
#include "Codec/AACEncoder.h"
#endif //ENABLE_FAAC
#ifdef ENABLE_X264
#include "Codec/H264Encoder.h"
#endif //ENABLE_X264
using namespace toolkit;
namespace mediakit {
@@ -26,8 +33,8 @@ DevChannel::DevChannel(const string &vhost, const string &app, const string &str
DevChannel::~DevChannel() {}
#ifdef ENABLE_X264
void DevChannel::inputYUV(char* apcYuv[3], int aiYuvLen[3], uint32_t uiStamp) {
#ifdef ENABLE_X264
//TimeTicker1(50);
if (!_pH264Enc) {
_pH264Enc.reset(new H264Encoder());
@@ -43,11 +50,13 @@ void DevChannel::inputYUV(char* apcYuv[3], int aiYuvLen[3], uint32_t uiStamp) {
inputH264((char *) pOut[i].pucData, pOut[i].iLength, uiStamp);
}
}
}
#else
WarnL << "h264编码未启用,该方法无效,编译时请打开ENABLE_X264选项";
#endif //ENABLE_X264
}
#ifdef ENABLE_FAAC
void DevChannel::inputPCM(char* pcData, int iDataLen, uint32_t uiStamp) {
#ifdef ENABLE_FAAC
if (!_pAacEnc) {
_pAacEnc.reset(new AACEncoder());
if (!_pAacEnc->init(_audio->iSampleRate, _audio->iChannel, _audio->iSampleBit)) {
@@ -62,8 +71,10 @@ void DevChannel::inputPCM(char* pcData, int iDataLen, uint32_t uiStamp) {
inputAAC((char *) pucOut + 7, iRet - 7, uiStamp, (char *)pucOut);
}
}
}
#else
WarnL << "aac编码未启用,该方法无效,编译时请打开ENABLE_FAAC选项";
#endif //ENABLE_FAAC
}
void DevChannel::inputH264(const char *data, int len, uint32_t dts, uint32_t pts) {
if(dts == 0){

View File

@@ -20,16 +20,11 @@
using namespace std;
using namespace toolkit;
#ifdef ENABLE_FAAC
#include "Codec/AACEncoder.h"
#endif //ENABLE_FAAC
#ifdef ENABLE_X264
#include "Codec/H264Encoder.h"
#endif //ENABLE_X264
namespace mediakit {
class H264Encoder;
class AACEncoder;
class VideoInfo {
public:
CodecId codecId = CodecH264;
@@ -107,7 +102,6 @@ public:
*/
void inputAudio(const char *data, int len, uint32_t dts);
#ifdef ENABLE_X264
/**
* 输入yuv420p视频帧内部会完成编码并调用inputH264方法
* @param apcYuv
@@ -115,9 +109,7 @@ public:
* @param uiStamp
*/
void inputYUV(char *apcYuv[3], int aiYuvLen[3], uint32_t uiStamp);
#endif //ENABLE_X264
#ifdef ENABLE_FAAC
/**
* 输入pcm数据内部会完成编码并调用inputAAC方法
@@ -126,20 +118,13 @@ public:
* @param uiStamp
*/
void inputPCM(char *pcData, int iDataLen, uint32_t uiStamp);
#endif //ENABLE_FAAC
private:
MediaOriginType getOriginType(MediaSource &sender) const override;
private:
#ifdef ENABLE_X264
std::shared_ptr<H264Encoder> _pH264Enc;
#endif //ENABLE_X264
#ifdef ENABLE_FAAC
std::shared_ptr<AACEncoder> _pAacEnc;
#endif //ENABLE_FAAC
std::shared_ptr<VideoInfo> _video;
std::shared_ptr<AudioInfo> _audio;
SmoothTicker _aTicker[2];

View File

@@ -46,6 +46,7 @@ void HttpClient::sendRequest(const string &strUrl, float fTimeOutSec) {
if (_path.empty()) {
_path = "/";
}
auto host_header = host;
uint16_t port = atoi(FindField(host.data(), ":", NULL).data());
if (port <= 0) {
//默认端口
@@ -54,7 +55,7 @@ void HttpClient::sendRequest(const string &strUrl, float fTimeOutSec) {
//服务器域名
host = FindField(host.data(), NULL, ":");
}
_header.emplace("Host", host);
_header.emplace("Host", host_header);
_header.emplace("Tools", SERVER_NAME);
_header.emplace("Connection", "keep-alive");
_header.emplace("Accept", "*/*");

View File

@@ -78,7 +78,8 @@ std::shared_ptr<MediaSinkInterface> Recorder::createRecorder(type type, const st
switch (type) {
case Recorder::type_hls: {
#if defined(ENABLE_HLS)
auto ret = std::make_shared<HlsRecorder>(path, string(VHOST_KEY) + "=" + vhost, 0);
GET_CONFIG(bool, enable_vhost, General::kEnableVhost);
auto ret = std::make_shared<HlsRecorder>(path, enable_vhost ? string(VHOST_KEY) + "=" + vhost : "", 0);
InfoL << "create Hls Record ret "<<ret;
ret->setMediaSource(vhost, app, stream_id);
return ret;
@@ -95,7 +96,8 @@ std::shared_ptr<MediaSinkInterface> Recorder::createRecorder(type type, const st
case Recorder::type_hls_record: {
#if defined(ENABLE_HLS)
auto ret = std::make_shared<HlsRecorder>(path, string(VHOST_KEY) + "=" + vhost, 2);
GET_CONFIG(bool, enable_vhost, General::kEnableVhost);
auto ret = std::make_shared<HlsRecorder>(path, enable_vhost ? string(VHOST_KEY) + "=" + vhost : "", 2);
InfoL << "create Hls Record ret "<<ret;
ret->setMediaSource(vhost, app, stream_id);
return ret;

View File

@@ -10,6 +10,8 @@
#include "RtpCache.h"
#if defined(ENABLE_RTPPROXY)
namespace mediakit{
RtpCache::RtpCache(onFlushed cb) {
@@ -31,3 +33,5 @@ void RtpCachePS::onRTP(Buffer::Ptr buffer) {
}
}//namespace mediakit
#endif//#if defined(ENABLE_RTPPROXY)

View File

@@ -11,6 +11,8 @@
#ifndef ZLMEDIAKIT_RTPCACHE_H
#define ZLMEDIAKIT_RTPCACHE_H
#if defined(ENABLE_RTPPROXY)
#include "PSEncoder.h"
#include "Extension/CommonRtp.h"
@@ -46,4 +48,5 @@ protected:
};
}//namespace mediakit
#endif//ENABLE_RTPPROXY
#endif //ZLMEDIAKIT_RTPCACHE_H