|
@@ -36,13 +36,13 @@ bool StreamNode::open_stream() {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
- auto codec_id = demuxer_->get_video_codec();
|
|
|
|
- if (codec_id == AV_CODEC_ID_NONE) {
|
|
|
|
- fprintf(stderr, "StreamNode [%s] Error: Could not get video codec from demuxer for %s\n", name_.c_str(), stream_url_.c_str());
|
|
|
|
- demuxer_.reset(); // Clean up demuxer
|
|
|
|
- status_ = StreamStatus::OPEN_FAILED;
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
|
|
+ // auto codec_id = demuxer_->get_video_codec();
|
|
|
|
+ // if (codec_id == AV_CODEC_ID_NONE) {
|
|
|
|
+ // fprintf(stderr, "StreamNode [%s] Error: Could not get video codec from demuxer for %s\n", name_.c_str(), stream_url_.c_str());
|
|
|
|
+ // demuxer_.reset(); // Clean up demuxer
|
|
|
|
+ // status_ = StreamStatus::OPEN_FAILED;
|
|
|
|
+ // return false;
|
|
|
|
+ // }
|
|
|
|
|
|
decoder_ = FFHDDecoder::create_cuvid_decoder(
|
|
decoder_ = FFHDDecoder::create_cuvid_decoder(
|
|
false, FFHDDecoder::ffmpeg2NvCodecId(codec_id), -1, gpu_id_, nullptr, nullptr, true
|
|
false, FFHDDecoder::ffmpeg2NvCodecId(codec_id), -1, gpu_id_, nullptr, nullptr, true
|
|
@@ -201,7 +201,7 @@ void StreamNode::process_stream_cpu()
|
|
// Use clone() to ensure the pushed data is independent if frame is reused by VideoCapture
|
|
// Use clone() to ensure the pushed data is independent if frame is reused by VideoCapture
|
|
metaData->image = frame.clone();
|
|
metaData->image = frame.clone();
|
|
metaData->from = name_;
|
|
metaData->from = name_;
|
|
- metaData->timestamp = getCurrentTimestamp(); // Add timestamp if useful
|
|
|
|
|
|
+ // metaData->timestamp = getCurrentTimestamp(); // Add timestamp if useful
|
|
|
|
|
|
bool pushed = false;
|
|
bool pushed = false;
|
|
for (auto& output_buffer : output_buffers_)
|
|
for (auto& output_buffer : output_buffers_)
|
|
@@ -294,7 +294,7 @@ void StreamNode::process_stream_gpu()
|
|
try
|
|
try
|
|
{
|
|
{
|
|
// Pass pointers to get the actual index and PTS for the current frame
|
|
// Pass pointers to get the actual index and PTS for the current frame
|
|
- frame_data = decoder_->get_frame(&frame_pts, ¤t_frame_index);
|
|
|
|
|
|
+ frame_data = decoder_->get_frame(&frame_pts, current_frame_index);
|
|
}
|
|
}
|
|
catch (const std::exception& ex) { // Catch potential exceptions from get_frame implementation
|
|
catch (const std::exception& ex) { // Catch potential exceptions from get_frame implementation
|
|
fprintf(stderr, "StreamNode [%s] Error: Exception during decoder_->get_frame(): %s\n", name_.c_str(), ex.what());
|
|
fprintf(stderr, "StreamNode [%s] Error: Exception during decoder_->get_frame(): %s\n", name_.c_str(), ex.what());
|
|
@@ -328,7 +328,7 @@ void StreamNode::process_stream_gpu()
|
|
auto metaData = std::make_shared<meta::MetaData>();
|
|
auto metaData = std::make_shared<meta::MetaData>();
|
|
metaData->image = frame_gpu.clone(); // CLONE is crucial here!
|
|
metaData->image = frame_gpu.clone(); // CLONE is crucial here!
|
|
metaData->from = name_;
|
|
metaData->from = name_;
|
|
- metaData->timestamp = getCurrentTimestamp(); // Or use frame_pts if preferred
|
|
|
|
|
|
+ // metaData->timestamp = getCurrentTimestamp(); // Or use frame_pts if preferred
|
|
// metaData->frame_idx = frame_count_; // Add frame index if needed downstream
|
|
// metaData->frame_idx = frame_count_; // Add frame index if needed downstream
|
|
|
|
|
|
bool pushed = false;
|
|
bool pushed = false;
|