mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-08 12:24:55 +00:00
spice client: cosmetic changes
This commit is contained in:
parent
219105794b
commit
71567dabe3
@ -58,7 +58,7 @@ private:
|
||||
uint32_t _frame_count;
|
||||
};
|
||||
|
||||
class RecordChannel: public RedChannel, private Platform::RecordClinet {
|
||||
class RecordChannel: public RedChannel, private Platform::RecordClient {
|
||||
public:
|
||||
RecordChannel(RedClient& client, uint32_t id);
|
||||
~RecordChannel(void);
|
||||
|
||||
@ -65,8 +65,8 @@ public:
|
||||
|
||||
static void set_thread_priority(void *thread, ThreadPriority priority);
|
||||
|
||||
class RecordClinet;
|
||||
static WaveRecordAbstract* create_recorder(RecordClinet& client,
|
||||
class RecordClient;
|
||||
static WaveRecordAbstract* create_recorder(RecordClient& client,
|
||||
uint32_t sampels_per_sec,
|
||||
uint32_t bits_per_sample,
|
||||
uint32_t channels);
|
||||
@ -114,10 +114,9 @@ public:
|
||||
virtual void on_monitors_change() = 0;
|
||||
};
|
||||
|
||||
// TODO: tmp till all channels work with ProcessLoop
|
||||
class Platform::RecordClinet {
|
||||
class Platform::RecordClient {
|
||||
public:
|
||||
virtual ~RecordClinet() {}
|
||||
virtual ~RecordClient() {}
|
||||
virtual void add_event_source(EventSources::File& evnet_source) = 0;
|
||||
virtual void remove_event_source(EventSources::File& evnet_source) = 0;
|
||||
virtual void add_event_source(EventSources::Trigger& evnet_source) = 0;
|
||||
|
||||
@ -97,7 +97,7 @@ int EventsQueue::push_event(Event* event)
|
||||
{
|
||||
Lock lock(_events_lock);
|
||||
_events.push_back(event);
|
||||
event->_generation = _events_gen;
|
||||
event->set_generation(_events_gen);
|
||||
event->ref();
|
||||
#ifdef RED_DEBUG
|
||||
event->set_process_loop(&_owner);
|
||||
@ -116,7 +116,7 @@ void EventsQueue::process_events()
|
||||
return;
|
||||
}
|
||||
event = _events.front();
|
||||
if (event->_generation == _events_gen) {
|
||||
if (event->get_generation() == _events_gen) {
|
||||
return;
|
||||
}
|
||||
_events.pop_front();
|
||||
@ -160,6 +160,22 @@ void Timer::disarm()
|
||||
_is_armed = false;
|
||||
}
|
||||
|
||||
#define TIMER_COMPENSATION
|
||||
|
||||
void Timer::calc_next_expiration_time(uint64_t now)
|
||||
{
|
||||
#ifndef TIMER_COMPENSATION
|
||||
_expiratoin = now;
|
||||
#endif
|
||||
calc_next_expiration_time();
|
||||
#ifdef TIMER_COMPENSATION
|
||||
if (_expiration <= now) {
|
||||
_expiration = now;
|
||||
calc_next_expiration_time();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint64_t Timer::get_now()
|
||||
{
|
||||
return (Platform::get_monolithic_time() / 1000 / 1000);
|
||||
@ -226,7 +242,6 @@ int TimersQueue::get_soonest_timeout()
|
||||
return (int)(next_time - now);
|
||||
}
|
||||
|
||||
#define TIMER_COMPENSATION
|
||||
|
||||
void TimersQueue::timers_action()
|
||||
{
|
||||
@ -238,16 +253,7 @@ void TimersQueue::timers_action()
|
||||
((*iter)->get_expiration() <= now)) {
|
||||
Timer* timer = *iter;
|
||||
_armed_timers.erase(iter);
|
||||
#ifndef TIMER_COMPENSATION
|
||||
timer->_experatoin = now;
|
||||
#endif
|
||||
timer->calc_next_expiration_time();
|
||||
#ifdef TIMER_COMPENSATION
|
||||
if (timer->_expiration <= now) {
|
||||
timer->_expiration = now;
|
||||
timer->calc_next_expiration_time();
|
||||
}
|
||||
#endif
|
||||
timer->calc_next_expiration_time(now);
|
||||
_armed_timers.insert(timer);
|
||||
timer->response(_owner);
|
||||
}
|
||||
|
||||
@ -64,6 +64,10 @@ protected:
|
||||
AbstractProcessLoop* _process_loop;
|
||||
#endif
|
||||
|
||||
private:
|
||||
void set_generation(uint32_t gen) { _generation = gen;}
|
||||
uint32_t get_generation() { return _generation;}
|
||||
|
||||
private:
|
||||
uint32_t _generation;
|
||||
|
||||
@ -127,6 +131,7 @@ private:
|
||||
void disarm();
|
||||
uint64_t get_expiration() const { return _expiration;}
|
||||
void calc_next_expiration_time() { _expiration += _interval;}
|
||||
void calc_next_expiration_time(uint64_t now);
|
||||
|
||||
static uint64_t get_now();
|
||||
|
||||
|
||||
@ -108,7 +108,6 @@ struct SyncInfo {
|
||||
|
||||
class RedChannel: public RedChannelBase {
|
||||
public:
|
||||
friend class RedCannel;
|
||||
class MessageHandler;
|
||||
class OutMessage;
|
||||
|
||||
|
||||
@ -405,7 +405,7 @@ void Platform::set_process_loop(ProcessLoop& main_process_loop)
|
||||
main_loop = &main_process_loop;
|
||||
}
|
||||
|
||||
WaveRecordAbstract* Platform::create_recorder(RecordClinet& client,
|
||||
WaveRecordAbstract* Platform::create_recorder(RecordClient& client,
|
||||
uint32_t sampels_per_sec,
|
||||
uint32_t bits_per_sample,
|
||||
uint32_t channels)
|
||||
|
||||
@ -29,7 +29,7 @@ static void CALLBACK in_proc(HWAVEIN handle, UINT msg, DWORD user_data, DWORD pa
|
||||
recorder->trigger();
|
||||
}
|
||||
|
||||
WaveRecorder::WaveRecorder(Platform::RecordClinet& client, uint32_t sampels_per_sec,
|
||||
WaveRecorder::WaveRecorder(Platform::RecordClient& client, uint32_t sampels_per_sec,
|
||||
uint32_t bits_per_sample, uint32_t channels)
|
||||
: _client (client)
|
||||
, _ring (NULL)
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
class WaveRecorder: public WaveRecordAbstract, public EventSources::Trigger {
|
||||
public:
|
||||
WaveRecorder(Platform::RecordClinet& client, uint32_t sampels_per_sec,
|
||||
WaveRecorder(Platform::RecordClient& client, uint32_t sampels_per_sec,
|
||||
uint32_t bits_per_sample, uint32_t channels);
|
||||
virtual ~WaveRecorder();
|
||||
|
||||
@ -42,7 +42,7 @@ private:
|
||||
void push_frames();
|
||||
|
||||
private:
|
||||
Platform::RecordClinet& _client;
|
||||
Platform::RecordClient& _client;
|
||||
HWAVEIN _wave_in;
|
||||
uint8_t* _ring;
|
||||
uint32_t _ring_item_size;
|
||||
|
||||
@ -2212,7 +2212,7 @@ void Platform::set_keyboard_modifiers(uint32_t modifiers)
|
||||
}
|
||||
}
|
||||
|
||||
WaveRecordAbstract* Platform::create_recorder(RecordClinet& client,
|
||||
WaveRecordAbstract* Platform::create_recorder(RecordClient& client,
|
||||
uint32_t sampels_per_sec,
|
||||
uint32_t bits_per_sample,
|
||||
uint32_t channels)
|
||||
|
||||
@ -42,7 +42,7 @@ void WaveRecorder::EventTrigger::on_event()
|
||||
_recorder.on_event();
|
||||
}
|
||||
|
||||
WaveRecorder::WaveRecorder(Platform::RecordClinet& client,
|
||||
WaveRecorder::WaveRecorder(Platform::RecordClient& client,
|
||||
uint32_t sampels_per_sec,
|
||||
uint32_t bits_per_sample,
|
||||
uint32_t channels)
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
class WaveRecorder: public WaveRecordAbstract {
|
||||
public:
|
||||
WaveRecorder(Platform::RecordClinet& client,
|
||||
WaveRecorder(Platform::RecordClient& client,
|
||||
uint32_t sampels_per_sec,
|
||||
uint32_t bits_per_sample,
|
||||
uint32_t channels);
|
||||
@ -44,7 +44,7 @@ private:
|
||||
void on_event();
|
||||
|
||||
private:
|
||||
Platform::RecordClinet& _client;
|
||||
Platform::RecordClient& _client;
|
||||
snd_pcm_t* _pcm;
|
||||
snd_pcm_hw_params_t* _hw_params;
|
||||
snd_pcm_sw_params_t* _sw_params;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user