From 85c5a18ce764a9eb8d4aee1e6681be17fbab6e94 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Tue, 6 Jun 2023 17:38:38 +0800 Subject: [PATCH] fix: Failed to decode data on loop mode --- DSView/pv/data/decoderstack.cpp | 20 +++++++++++++------- DSView/pv/data/logicsnapshot.cpp | 3 +-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/DSView/pv/data/decoderstack.cpp b/DSView/pv/data/decoderstack.cpp index 0ed53c02..c492f69f 100644 --- a/DSView/pv/data/decoderstack.cpp +++ b/DSView/pv/data/decoderstack.cpp @@ -546,10 +546,10 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod if (!bCheckEnd){ bCheckEnd = true; - uint64_t mipmap_sample_count = _snapshot->get_ring_sample_count(); + uint64_t align_sample_count = _snapshot->get_ring_sample_count(); - if (end_index >= mipmap_sample_count){ - end_index = mipmap_sample_count - 1; + if (end_index >= align_sample_count){ + end_index = align_sample_count - 1; dsv_info("Reset the decode end sample, new:%llu, old:%llu", end_index, decode_end); } } @@ -603,7 +603,7 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod if (chunk_end - i > MaxChunkSize) chunk_end = i + MaxChunkSize; - bEndTime = chunk_end == end_index; + bEndTime = (chunk_end == end_index); if (srd_session_send( session, @@ -614,8 +614,12 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod chunk_end - i, &error) != SRD_OK){ - if (error) - _error_message = QString::fromLocal8Bit(error); + if (error){ + _error_message = QString::fromLocal8Bit(error); + dsv_err("Failed to call srd_session_send:%s", error); + g_free(error); + error = NULL; + } bError = true; break; @@ -649,8 +653,10 @@ void DecoderStack::decode_data(const uint64_t decode_start, const uint64_t decod if (!bError && bEndTime){ srd_session_end(session, &error); - if (error != NULL) + if (error != NULL){ _error_message = QString::fromLocal8Bit(error); + dsv_err("Failed to call srd_session_end:%s", error); + } } dsv_info("%s%llu", "send to decoder times: ", entry_cnt); diff --git a/DSView/pv/data/logicsnapshot.cpp b/DSView/pv/data/logicsnapshot.cpp index 48069f09..5fdf9a10 100644 --- a/DSView/pv/data/logicsnapshot.cpp +++ b/DSView/pv/data/logicsnapshot.cpp @@ -587,7 +587,7 @@ const uint8_t *LogicSnapshot::get_samples(uint64_t start_sample, uint64_t &end_s assert(start_sample <= end_sample); start_sample += _loop_offset; - _ring_sample_count += _loop_offset; + _ring_sample_count += _loop_offset; int order = get_ch_order(sig_index); uint64_t index0 = start_sample >> (LeafBlockPower + RootScalePower); @@ -600,7 +600,6 @@ const uint8_t *LogicSnapshot::get_samples(uint64_t start_sample, uint64_t &end_s end_sample = min(end_sample + 1, sample_count); - end_sample -= _loop_offset; _ring_sample_count -= _loop_offset; if (order == -1 || _ch_data[order][index0].lbp[index1] == NULL)