summaryrefslogtreecommitdiffstats
path: root/client/record_channel.cpp
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2011-09-18 21:42:18 +0300
committerYonit Halperin <yhalperi@redhat.com>2011-11-02 11:30:27 +0200
commit87664af999a534090c37ffb53aec2a6cd970cdcc (patch)
tree3d9beb3214ee7f1fece060f8b3235ffd6e3defcd /client/record_channel.cpp
parent0a5e9cbbcf9a3ebc6c7e3ccd3e7026998d2488d9 (diff)
downloadspice-87664af999a534090c37ffb53aec2a6cd970cdcc.tar.gz
spice-87664af999a534090c37ffb53aec2a6cd970cdcc.tar.xz
spice-87664af999a534090c37ffb53aec2a6cd970cdcc.zip
client: playback/record channels: implement on_disconnect
(cherry picked from commit d3ed9d5e9d52ddcadcb3c8c77dd827b50071d813 branch 0.8)
Diffstat (limited to 'client/record_channel.cpp')
-rw-r--r--client/record_channel.cpp39
1 files changed, 24 insertions, 15 deletions
diff --git a/client/record_channel.cpp b/client/record_channel.cpp
index 738f98fd..04760311 100644
--- a/client/record_channel.cpp
+++ b/client/record_channel.cpp
@@ -101,14 +101,7 @@ RecordChannel::~RecordChannel(void)
_messages.pop_front();
delete mes;
}
- delete _wave_recorder;
-
- if (_celt_encoder) {
- celt051_encoder_destroy(_celt_encoder);
- }
- if (_celt_mode) {
- celt051_mode_destroy(_celt_mode);
- }
+ clear();
}
bool RecordChannel::abort(void)
@@ -128,6 +121,11 @@ void RecordChannel::on_connect()
post_message(message);
}
+void RecordChannel::on_disconnect()
+{
+ clear();
+}
+
void RecordChannel::send_start_mark()
{
Message* message = new Message(SPICE_MSGC_RECORD_START_MARK);
@@ -177,6 +175,23 @@ void RecordChannel::handle_start(RedPeer::InMessage* message)
_wave_recorder->start();
}
+void RecordChannel::clear()
+{
+ if (_wave_recorder) {
+ _wave_recorder->stop();
+ delete _wave_recorder;
+ _wave_recorder = NULL;
+ }
+ if (_celt_encoder) {
+ celt051_encoder_destroy(_celt_encoder);
+ _celt_encoder = NULL;
+ }
+ if (_celt_mode) {
+ celt051_mode_destroy(_celt_mode);
+ _celt_mode = NULL;
+ }
+}
+
void RecordChannel::handle_stop(RedPeer::InMessage* message)
{
RecordHandler* handler = static_cast<RecordHandler*>(get_message_handler());
@@ -186,13 +201,7 @@ void RecordChannel::handle_stop(RedPeer::InMessage* message)
return;
}
ASSERT(_celt_mode && _celt_encoder);
- _wave_recorder->stop();
- celt051_encoder_destroy(_celt_encoder);
- _celt_encoder = NULL;
- celt051_mode_destroy(_celt_mode);
- _celt_mode = NULL;
- delete _wave_recorder;
- _wave_recorder = NULL;
+ clear();
}
RecordSamplesMessage* RecordChannel::get_message()