mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
Fix MacOS compile error
This commit is contained in:
@@ -101,10 +101,8 @@ int FfmpegVideoDecoder::Decode(
|
||||
std::function<void(VideoFrame)> on_receive_decoded_frame) {
|
||||
if (!first_) {
|
||||
if ((*(data + 4) & 0x1f) != 0x07) {
|
||||
LOG_ERROR("1");
|
||||
return -1;
|
||||
} else {
|
||||
LOG_ERROR("2");
|
||||
first_ = true;
|
||||
}
|
||||
}
|
||||
@@ -149,7 +147,7 @@ int FfmpegVideoDecoder::Decode(
|
||||
std::chrono::high_resolution_clock::now().time_since_epoch())
|
||||
.count());
|
||||
|
||||
LOG_ERROR("cost {}", now_ts - start_ts);
|
||||
// LOG_ERROR("cost {}", now_ts - start_ts);
|
||||
|
||||
on_receive_decoded_frame(*decoded_frame_);
|
||||
if (SAVE_DECODER_STREAM) {
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
#include "video_decoder_factory.h"
|
||||
|
||||
#if __APPLE__
|
||||
#include "ffmpeg/ffmpeg_video_decoder.h"
|
||||
#else
|
||||
#include "ffmpeg/ffmpeg_video_decoder.h"
|
||||
#include "log.h"
|
||||
#include "nvcodec/nvidia_video_decoder.h"
|
||||
#endif
|
||||
|
||||
#include "log.h"
|
||||
|
||||
VideoDecoderFactory::VideoDecoderFactory() {}
|
||||
|
||||
@@ -10,6 +15,9 @@ VideoDecoderFactory::~VideoDecoderFactory() {}
|
||||
|
||||
std::unique_ptr<VideoDecoder> VideoDecoderFactory::CreateVideoDecoder(
|
||||
bool hardware_acceleration) {
|
||||
#if __APPLE__
|
||||
return std::make_unique<FfmpegVideoDecoder>(FfmpegVideoDecoder());
|
||||
#else
|
||||
if (hardware_acceleration) {
|
||||
if (CheckIsHardwareAccerlerationSupported()) {
|
||||
return std::make_unique<NvidiaVideoDecoder>(NvidiaVideoDecoder());
|
||||
@@ -19,9 +27,13 @@ std::unique_ptr<VideoDecoder> VideoDecoderFactory::CreateVideoDecoder(
|
||||
} else {
|
||||
return std::make_unique<FfmpegVideoDecoder>(FfmpegVideoDecoder());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VideoDecoderFactory::CheckIsHardwareAccerlerationSupported() {
|
||||
#if __APPLE__
|
||||
return false;
|
||||
#else
|
||||
CUresult cuResult;
|
||||
|
||||
CUvideoctxlock cudaCtxLock;
|
||||
@@ -34,4 +46,5 @@ bool VideoDecoderFactory::CheckIsHardwareAccerlerationSupported() {
|
||||
}
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
#include "video_encoder_factory.h"
|
||||
|
||||
#if __APPLE__
|
||||
#include "ffmpeg/ffmpeg_video_encoder.h"
|
||||
#else
|
||||
#include "ffmpeg/ffmpeg_video_encoder.h"
|
||||
#include "log.h"
|
||||
#include "nvcodec/nvidia_video_encoder.h"
|
||||
#endif
|
||||
|
||||
#include "log.h"
|
||||
|
||||
VideoEncoderFactory::VideoEncoderFactory() {}
|
||||
|
||||
@@ -10,6 +15,9 @@ VideoEncoderFactory::~VideoEncoderFactory() {}
|
||||
|
||||
std::unique_ptr<VideoEncoder> VideoEncoderFactory::CreateVideoEncoder(
|
||||
bool hardware_acceleration) {
|
||||
#if __APPLE__
|
||||
return std::make_unique<FFmpegVideoEncoder>(FFmpegVideoEncoder());
|
||||
#else
|
||||
if (hardware_acceleration) {
|
||||
if (CheckIsHardwareAccerlerationSupported()) {
|
||||
return std::make_unique<NvidiaVideoEncoder>(NvidiaVideoEncoder());
|
||||
@@ -19,9 +27,13 @@ std::unique_ptr<VideoEncoder> VideoEncoderFactory::CreateVideoEncoder(
|
||||
} else {
|
||||
return std::make_unique<FFmpegVideoEncoder>(FFmpegVideoEncoder());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VideoEncoderFactory::CheckIsHardwareAccerlerationSupported() {
|
||||
#if __APPLE__
|
||||
return false;
|
||||
#else
|
||||
CUresult cuResult;
|
||||
NV_ENCODE_API_FUNCTION_LIST functionList = {NV_ENCODE_API_FUNCTION_LIST_VER};
|
||||
|
||||
@@ -42,4 +54,5 @@ bool VideoEncoderFactory::CheckIsHardwareAccerlerationSupported() {
|
||||
}
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user