diff --git a/plugins/publish/publish_node.cpp b/plugins/publish/publish_node.cpp index e28dc01..026c582 100644 --- a/plugins/publish/publish_node.cpp +++ b/plugins/publish/publish_node.cpp @@ -642,6 +642,8 @@ public: fps_ = config.ValueOr("fps", 25); gop_ = config.ValueOr("gop", 50); bitrate_kbps_ = config.ValueOr("bitrate_kbps", 4000); + mpp_output_timeout_ms_ = config.ValueOr("mpp_output_timeout_ms", mpp_output_timeout_ms_); + mpp_packet_wait_ms_ = config.ValueOr("mpp_packet_wait_ms", mpp_packet_wait_ms_); platform_ = config.ValueOr("platform", ""); hw_platform_ = config.ValueOr("hw_platform", ""); use_mpp_ = config.ValueOr("use_mpp", true); @@ -746,6 +748,8 @@ public: int new_fps = new_config.ValueOr("fps", fps_); int new_gop = new_config.ValueOr("gop", gop_); int new_bitrate = new_config.ValueOr("bitrate_kbps", bitrate_kbps_); + int new_output_timeout = new_config.ValueOr("mpp_output_timeout_ms", mpp_output_timeout_ms_); + int new_packet_wait = new_config.ValueOr("mpp_packet_wait_ms", mpp_packet_wait_ms_); if (new_codec != codec_) return false; @@ -754,6 +758,8 @@ public: fps_ = new_fps; gop_ = new_gop; bitrate_kbps_ = new_bitrate; + mpp_output_timeout_ms_ = new_output_timeout; + mpp_packet_wait_ms_ = new_packet_wait; use_mpp_ = new_use_mpp; use_ffmpeg_mux_ = new_use_ffmpeg_mux; @@ -1252,6 +1258,8 @@ private: enc_obj["fps"] = SimpleJson(static_cast(fps_)); enc_obj["gop"] = SimpleJson(static_cast(gop_)); enc_obj["bitrate_kbps"] = SimpleJson(static_cast(bitrate_kbps_)); + enc_obj["mpp_output_timeout_ms"] = SimpleJson(static_cast(mpp_output_timeout_ms_)); + enc_obj["mpp_packet_wait_ms"] = SimpleJson(static_cast(mpp_packet_wait_ms_)); enc_obj["width"] = SimpleJson(static_cast(frame->width)); enc_obj["height"] = SimpleJson(static_cast(frame->height)); enc_obj["pixel_format"] = SimpleJson(PixelFormatToString(frame->format)); @@ -1363,6 +1371,8 @@ private: int fps_ = 25; int gop_ = 50; int bitrate_kbps_ = 4000; + int mpp_output_timeout_ms_ = 50; + int mpp_packet_wait_ms_ = 10; std::string platform_; std::string hw_platform_; bool use_mpp_ = false; diff --git a/src/hw_codec.cpp b/src/hw_codec.cpp index 9cb7d3d..be582e2 100644 --- a/src/hw_codec.cpp +++ b/src/hw_codec.cpp @@ -595,7 +595,7 @@ private: } uint8_t* dst_uv = dst + hor_stride_ * ver_stride_; - int uv_rows = ver_stride_ / 2; + const int uv_rows = std::max(0, height_ / 2); if (mpp_fmt_ == MPP_FMT_YUV420SP) { for (int row = 0; row < uv_rows; ++row) { std::memcpy(dst_uv + row * hor_stride_, uv.data + row * uv.stride,