summaryrefslogtreecommitdiff
path: root/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/media_manager/src/video/video_stream_to_file_adapter.cc')
-rw-r--r--src/components/media_manager/src/video/video_stream_to_file_adapter.cc22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
index 6b038a9fd2..983f1278c9 100644
--- a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
+++ b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
@@ -42,28 +42,25 @@ CREATE_LOGGERPTR_GLOBAL(logger, "VideoStreamToFileAdapter")
VideoStreamToFileAdapter::VideoStreamToFileAdapter(const std::string& file_name)
: file_name_(file_name),
is_ready_(false),
- thread_(threads::CreateThread("VideoStreamer",
- new Streamer(this))) {
+ thread_(NULL) {
Init();
}
VideoStreamToFileAdapter::~VideoStreamToFileAdapter() {
- LOG4CXX_AUTO_TRACE(logger);
if ((0 != current_application_ ) && (is_ready_)) {
StopActivity(current_application_);
}
- thread_->join();
- delete thread_->delegate();
- threads::DeleteThread(thread_);
+
+ thread_->stop();
}
void VideoStreamToFileAdapter::Init() {
- if (thread_->is_running()) {
- LOG4CXX_DEBUG(logger, "Start sending thread");
+ if (!thread_) {
+ LOG4CXX_INFO(logger, "Create and start sending thread");
+ thread_ = threads::CreateThread("VideoStreamer",
+ new Streamer(this));
const size_t kStackSize = 16384;
- thread_->start(threads::ThreadOptions(kStackSize));
- } else {
- LOG4CXX_WARN(logger, "thread is already running");
+ thread_->startWithOptions(threads::ThreadOptions(kStackSize));
}
}
@@ -172,10 +169,11 @@ void VideoStreamToFileAdapter::Streamer::threadMain() {
close();
}
-void VideoStreamToFileAdapter::Streamer::exitThreadMain() {
+bool VideoStreamToFileAdapter::Streamer::exitThreadMain() {
LOG4CXX_INFO(logger, "Streamer::exitThreadMain");
stop_flag_ = true;
server_->messages_.Shutdown();
+ return false;
}
void VideoStreamToFileAdapter::Streamer::open() {