Skip to content

Commit

Permalink
JetPack 5.1.2 で同じフレームが送信され続ける問題を修正する
Browse files Browse the repository at this point in the history
  • Loading branch information
enm10k committed Dec 26, 2023
1 parent e45af9b commit 7e5c4d4
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/hwenc_jetson/jetson_jpeg_decoder_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ namespace sora {
std::shared_ptr<JetsonJpegDecoder> JetsonJpegDecoderPool::Pop() {
std::shared_ptr<NvJPEGDecoder> nv_decoder;

{
std::lock_guard<std::mutex> lock(mtx_);
if (decoder_queue_.size() == 0) {
nv_decoder.reset(NvJPEGDecoder::createJPEGDecoder("jpegdec"));
} else {
nv_decoder = std::move(decoder_queue_.front());
decoder_queue_.pop();
}
}
// JetPack 5.1.2 で同じフレームが送信され続ける問題が発生したため、キューを無効化した
// JetPack 5.1.1 では正常に動作していた
// momo で同様の問題に対応した際の PR: https://github.com/shiguredo/momo/pull/297/
// {
// std::lock_guard<std::mutex> lock(mtx_);
// if (decoder_queue_.size() == 0) {
// nv_decoder.reset(NvJPEGDecoder::createJPEGDecoder("jpegdec"));
// } else {
// nv_decoder = std::move(decoder_queue_.front());
// decoder_queue_.pop();
// }
// }
nv_decoder.reset(NvJPEGDecoder::createJPEGDecoder("jpegdec"));

std::shared_ptr<JetsonJpegDecoder> decoder(
new JetsonJpegDecoder(shared_from_this(), std::move(nv_decoder)));
Expand All @@ -28,7 +32,7 @@ std::shared_ptr<JetsonJpegDecoder> JetsonJpegDecoderPool::Pop() {

void JetsonJpegDecoderPool::Push(std::shared_ptr<NvJPEGDecoder> decoder) {
std::lock_guard<std::mutex> lock(mtx_);
decoder_queue_.push(std::move(decoder));
// decoder_queue_.push(std::move(decoder));
}

} // namespace sora

0 comments on commit 7e5c4d4

Please sign in to comment.