fix: voice interupt
This commit is contained in:
32
main/background_capture_service.h
Normal file
32
main/background_capture_service.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef BACKGROUND_CAPTURE_SERVICE_H
|
||||
#define BACKGROUND_CAPTURE_SERVICE_H
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class BackgroundCaptureService {
|
||||
public:
|
||||
BackgroundCaptureService();
|
||||
~BackgroundCaptureService();
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
bool IsRunning() const { return running_.load(); }
|
||||
|
||||
private:
|
||||
TaskHandle_t task_handle_ = nullptr;
|
||||
std::atomic<bool> running_ = false;
|
||||
uint32_t consecutive_failures_ = 0;
|
||||
|
||||
static void TaskEntry(void* arg);
|
||||
void Run();
|
||||
bool CaptureAndSendFrame();
|
||||
bool UploadJpegFrame(const std::string& jpeg_data);
|
||||
uint32_t GetFailureDelayMs() const;
|
||||
};
|
||||
|
||||
#endif // BACKGROUND_CAPTURE_SERVICE_H
|
||||
Reference in New Issue
Block a user