summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2009-11-09 17:20:30 +0200
committerYaniv Kamay <ykamay@redhat.com>2010-01-03 17:19:03 +0200
commit71567dabe364cbfd5f5a592f455c0a993f281ee0 (patch)
treea9b14297fbd8c7006f3e381348219f3098238882
parent219105794bd42dfd36e303ca73f1a546903e1846 (diff)
downloadspice-71567dabe364cbfd5f5a592f455c0a993f281ee0.tar.gz
spice-71567dabe364cbfd5f5a592f455c0a993f281ee0.tar.xz
spice-71567dabe364cbfd5f5a592f455c0a993f281ee0.zip
spice client: cosmetic changes
-rw-r--r--client/audio_channels.h2
-rw-r--r--client/platform.h9
-rw-r--r--client/process_loop.cpp32
-rw-r--r--client/process_loop.h5
-rw-r--r--client/red_channel.h1
-rw-r--r--client/windows/platform.cpp2
-rw-r--r--client/windows/record.cpp2
-rw-r--r--client/windows/record.h4
-rw-r--r--client/x11/platform.cpp2
-rw-r--r--client/x11/record.cpp2
-rw-r--r--client/x11/record.h4
11 files changed, 37 insertions, 28 deletions
diff --git a/client/audio_channels.h b/client/audio_channels.h
index 6a1c3a80..798917c3 100644
--- a/client/audio_channels.h
+++ b/client/audio_channels.h
@@ -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);
diff --git a/client/platform.h b/client/platform.h
index ef527d38..fec3244d 100644
--- a/client/platform.h
+++ b/client/platform.h
@@ -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;
diff --git a/client/process_loop.cpp b/client/process_loop.cpp
index 41aac43e..66f676f3 100644
--- a/client/process_loop.cpp
+++ b/client/process_loop.cpp
@@ -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);
}
diff --git a/client/process_loop.h b/client/process_loop.h
index 0b052522..df8650dc 100644
--- a/client/process_loop.h
+++ b/client/process_loop.h
@@ -65,6 +65,10 @@ protected:
#endif
private:
+ void set_generation(uint32_t gen) { _generation = gen;}
+ uint32_t get_generation() { return _generation;}
+
+private:
uint32_t _generation;
friend class EventsQueue;
@@ -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();
diff --git a/client/red_channel.h b/client/red_channel.h
index 670d6521..c2f94bd7 100644
--- a/client/red_channel.h
+++ b/client/red_channel.h
@@ -108,7 +108,6 @@ struct SyncInfo {
class RedChannel: public RedChannelBase {
public:
- friend class RedCannel;
class MessageHandler;
class OutMessage;
diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index b5faf758..d93283e5 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -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)
diff --git a/client/windows/record.cpp b/client/windows/record.cpp
index bd9bc022..d962fb7d 100644
--- a/client/windows/record.cpp
+++ b/client/windows/record.cpp
@@ -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)
diff --git a/client/windows/record.h b/client/windows/record.h
index cd33a2aa..283f2824 100644
--- a/client/windows/record.h
+++ b/client/windows/record.h
@@ -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;
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 8f318f2d..2c9a646a 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -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)
diff --git a/client/x11/record.cpp b/client/x11/record.cpp
index a220878c..46abb29e 100644
--- a/client/x11/record.cpp
+++ b/client/x11/record.cpp
@@ -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)
diff --git a/client/x11/record.h b/client/x11/record.h
index 540f1d2f..753665f0 100644
--- a/client/x11/record.h
+++ b/client/x11/record.h
@@ -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;