性能优化6
This commit is contained in:
parent
5c72a489a5
commit
4d22858d0f
@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <string>
|
||||
|
||||
#include "graph_manager.h"
|
||||
|
||||
namespace rk3588 {
|
||||
|
||||
class MediaServerApp {
|
||||
public:
|
||||
explicit MediaServerApp(std::string config_path);
|
||||
|
||||
int Start();
|
||||
|
||||
private:
|
||||
std::string config_path_;
|
||||
GraphManager graph_manager_{};
|
||||
|
||||
std::atomic<bool> stop_signal_thread_{false};
|
||||
std::thread signal_thread_;
|
||||
};
|
||||
|
||||
} // namespace rk3588
|
||||
@ -1,5 +1,6 @@
|
||||
#include "utils/dma_alloc.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdlib>
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
@ -189,7 +190,7 @@ DmaBufferPtr DmaAlloc(size_t alloc_size) {
|
||||
nullptr
|
||||
};
|
||||
|
||||
static bool first_success = true;
|
||||
static std::atomic<bool> first_success{true};
|
||||
|
||||
int dma_fd = -1;
|
||||
const char* used_heap = nullptr;
|
||||
@ -229,9 +230,8 @@ DmaBufferPtr DmaAlloc(size_t alloc_size) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (first_success) {
|
||||
if (first_success.exchange(false)) {
|
||||
LogInfo(std::string("[DmaAlloc] using heap: ") + (used_heap ? used_heap : "(unknown)"));
|
||||
first_success = false;
|
||||
}
|
||||
|
||||
void* ptr = mmap(nullptr, alloc_size, PROT_READ | PROT_WRITE, MAP_SHARED, dma_fd, 0);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user