mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
[fix] fix compile error on MacOSX
This commit is contained in:
@@ -6,11 +6,11 @@
|
|||||||
#else
|
#else
|
||||||
#include "dav1d/dav1d_av1_decoder.h"
|
#include "dav1d/dav1d_av1_decoder.h"
|
||||||
#include "nvcodec/nvidia_video_decoder.h"
|
#include "nvcodec/nvidia_video_decoder.h"
|
||||||
|
#include "nvcodec_api.h"
|
||||||
#include "openh264/openh264_decoder.h"
|
#include "openh264/openh264_decoder.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "nvcodec_api.h"
|
|
||||||
|
|
||||||
VideoDecoderFactory::VideoDecoderFactory() {}
|
VideoDecoderFactory::VideoDecoderFactory() {}
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
#else
|
#else
|
||||||
#include "aom/aom_av1_encoder.h"
|
#include "aom/aom_av1_encoder.h"
|
||||||
#include "nvcodec/nvidia_video_encoder.h"
|
#include "nvcodec/nvidia_video_encoder.h"
|
||||||
|
#include "nvcodec_api.h"
|
||||||
#include "openh264/openh264_encoder.h"
|
#include "openh264/openh264_encoder.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "nvcodec_api.h"
|
|
||||||
|
|
||||||
VideoEncoderFactory::VideoEncoderFactory() {}
|
VideoEncoderFactory::VideoEncoderFactory() {}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,11 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "nlohmann/json.hpp"
|
#include "nlohmann/json.hpp"
|
||||||
|
|
||||||
|
#if __APPLE__
|
||||||
|
#else
|
||||||
#include "nvcodec_api.h"
|
#include "nvcodec_api.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
using nlohmann::json;
|
using nlohmann::json;
|
||||||
|
|
||||||
@@ -212,20 +216,22 @@ int PeerConnection::CreateVideoCodec(bool hardware_acceleration) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hardware_acceleration_ = hardware_acceleration;
|
hardware_acceleration_ = hardware_acceleration;
|
||||||
#ifdef __APPLE__
|
|
||||||
if (hardware_acceleration_) {
|
|
||||||
hardware_acceleration_ = false;
|
|
||||||
LOG_WARN(
|
|
||||||
"MacOS not support hardware acceleration, use default software codec");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (av1_encoding_) {
|
if (av1_encoding_) {
|
||||||
video_encoder_ = VideoEncoderFactory::CreateVideoEncoder(false, true);
|
video_encoder_ = VideoEncoderFactory::CreateVideoEncoder(false, true);
|
||||||
video_decoder_ = VideoDecoderFactory::CreateVideoDecoder(false, true);
|
video_decoder_ = VideoDecoderFactory::CreateVideoDecoder(false, true);
|
||||||
LOG_WARN("Only support software codec for AV1");
|
LOG_WARN("Only support software codec for AV1");
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef __APPLE__
|
||||||
|
if (hardware_acceleration_) {
|
||||||
|
hardware_acceleration_ = false;
|
||||||
|
LOG_WARN(
|
||||||
|
"MacOS not support hardware acceleration, use default software "
|
||||||
|
"codec");
|
||||||
|
video_encoder_ = VideoEncoderFactory::CreateVideoEncoder(false, false);
|
||||||
|
video_decoder_ = VideoDecoderFactory::CreateVideoDecoder(false, false);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (hardware_acceleration_) {
|
if (hardware_acceleration_) {
|
||||||
if (0 == LoadNvCodecDll()) {
|
if (0 == LoadNvCodecDll()) {
|
||||||
load_nvcodec_dll_success = true;
|
load_nvcodec_dll_success = true;
|
||||||
@@ -239,6 +245,7 @@ int PeerConnection::CreateVideoCodec(bool hardware_acceleration) {
|
|||||||
video_decoder_ = VideoDecoderFactory::CreateVideoDecoder(false, false);
|
video_decoder_ = VideoDecoderFactory::CreateVideoDecoder(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!video_encoder_) {
|
if (!video_encoder_) {
|
||||||
@@ -606,9 +613,12 @@ int PeerConnection::Destroy() {
|
|||||||
nv12_data_ = nullptr;
|
nv12_data_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#else
|
||||||
if (hardware_acceleration_ && load_nvcodec_dll_success) {
|
if (hardware_acceleration_ && load_nvcodec_dll_success) {
|
||||||
ReleaseNvCodecDll();
|
ReleaseNvCodecDll();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user