Address feedback

This commit is contained in:
Feng Chen 2021-12-03 12:31:07 +08:00 committed by vonchenplus
parent 10cc89bfdf
commit 4a3c1192b8
5 changed files with 27 additions and 17 deletions

View file

@ -333,8 +333,8 @@ struct GPU::Impl {
return;
}
if (cdma_pushers.find(id) == cdma_pushers.end()) {
cdma_pushers[id] = std::make_unique<Tegra::CDmaPusher>(gpu);
if (!cdma_pushers.contains(id)) {
cdma_pushers.insert_or_assign(id, std::make_unique<Tegra::CDmaPusher>(gpu));
}
// SubmitCommandBuffer would make the nvdec operations async, this is not currently working
@ -345,8 +345,9 @@ struct GPU::Impl {
/// Frees the CDMAPusher instance to free up resources
void ClearCdmaInstance(u32 id) {
if (cdma_pushers.find(id) != cdma_pushers.end()) {
cdma_pushers.erase(id);
const auto iter = cdma_pushers.find(id);
if (iter != cdma_pushers.end()) {
cdma_pushers.erase(iter);
}
}