mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[fix] fix crash due to rtp extension
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include "nvcodec_api.h"
|
||||
|
||||
// #define SAVE_DECODED_NV12_STREAM
|
||||
// #define SAVE_RECEIVED_H264_STREAM
|
||||
#define SAVE_RECEIVED_H264_STREAM
|
||||
|
||||
NvidiaVideoDecoder::NvidiaVideoDecoder() {}
|
||||
NvidiaVideoDecoder::~NvidiaVideoDecoder() {
|
||||
@@ -66,10 +66,11 @@ int NvidiaVideoDecoder::Init() {
|
||||
int NvidiaVideoDecoder::Decode(
|
||||
const uint8_t *data, size_t size,
|
||||
std::function<void(VideoFrame)> on_receive_decoded_frame) {
|
||||
LOG_ERROR("1");
|
||||
if (!decoder) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_ERROR("2");
|
||||
#ifdef SAVE_RECEIVED_H264_STREAM
|
||||
fwrite((unsigned char *)data, 1, size, file_h264_);
|
||||
#endif
|
||||
@@ -79,11 +80,14 @@ int NvidiaVideoDecoder::Decode(
|
||||
}
|
||||
|
||||
int num_frame_returned = decoder->Decode(data, (int)size);
|
||||
LOG_ERROR("???? {}", num_frame_returned);
|
||||
for (size_t i = 0; i < num_frame_returned; ++i) {
|
||||
cudaVideoSurfaceFormat format = decoder->GetOutputFormat();
|
||||
LOG_ERROR("3");
|
||||
if (format == cudaVideoSurfaceFormat_NV12) {
|
||||
uint8_t *decoded_frame_buffer = nullptr;
|
||||
decoded_frame_buffer = decoder->GetFrame();
|
||||
LOG_ERROR("4");
|
||||
if (decoded_frame_buffer) {
|
||||
if (on_receive_decoded_frame) {
|
||||
VideoFrame decoded_frame(
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "nvcodec_common.h"
|
||||
|
||||
// #define SAVE_RECEIVED_NV12_STREAM
|
||||
// #define SAVE_ENCODED_H264_STREAM
|
||||
#define SAVE_ENCODED_H264_STREAM
|
||||
|
||||
NvidiaVideoEncoder::NvidiaVideoEncoder() {}
|
||||
NvidiaVideoEncoder::~NvidiaVideoEncoder() {
|
||||
|
||||
Reference in New Issue
Block a user