summaryrefslogtreecommitdiff
path: root/src/components/media_manager/src/streamer_adapter.cc
diff options
context:
space:
mode:
authorArtem Nosach <ANosach@luxoft.com>2015-08-04 15:21:42 +0300
committerArtem Nosach <ANosach@luxoft.com>2015-10-04 18:08:35 +0300
commit065c5b6508b59e08b758fef58d770b828dab11f8 (patch)
tree98acb5304082cdce75e7541213dcaef07d72721b /src/components/media_manager/src/streamer_adapter.cc
parentbcb60745463ab060502ee1dd32b31a2bc80d24d9 (diff)
downloadsdl_core-065c5b6508b59e08b758fef58d770b828dab11f8.tar.gz
Fix review comments
Related-issues: APPLINK-15198
Diffstat (limited to 'src/components/media_manager/src/streamer_adapter.cc')
-rw-r--r--src/components/media_manager/src/streamer_adapter.cc41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/components/media_manager/src/streamer_adapter.cc b/src/components/media_manager/src/streamer_adapter.cc
index d9967611a4..ef128a4417 100644
--- a/src/components/media_manager/src/streamer_adapter.cc
+++ b/src/components/media_manager/src/streamer_adapter.cc
@@ -42,19 +42,14 @@ StreamerAdapter::StreamerAdapter(Streamer* const streamer)
messages_(),
streamer_(streamer),
thread_(NULL) {
- if (streamer_) {
- thread_ = threads::CreateThread("StreamerAdapter", streamer_);
- }
+ DCHECK(streamer_);
+ thread_ = threads::CreateThread("StreamerAdapter", streamer_);
}
StreamerAdapter::~StreamerAdapter() {
- if (thread_) {
- thread_->join();
- threads::DeleteThread(thread_);
- }
- if (streamer_) {
- delete streamer_;
- }
+ thread_->join();
+ threads::DeleteThread(thread_);
+ delete streamer_;
}
void StreamerAdapter::StartActivity(int32_t application_key) {
@@ -65,10 +60,11 @@ void StreamerAdapter::StartActivity(int32_t application_key) {
return;
}
messages_.Reset();
- if (thread_) {
- const size_t kStackSize = 16384;
- thread_->start(threads::ThreadOptions(kStackSize));
- }
+
+ DCHECK(thread_);
+ const size_t kStackSize = 16384;
+ thread_->start(threads::ThreadOptions(kStackSize));
+
for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
media_listeners_.end() != it;
++it) {
@@ -84,9 +80,10 @@ void StreamerAdapter::StopActivity(int32_t application_key) {
<< application_key << " has not been started");
return;
}
- if (thread_) {
- thread_->stop();
- }
+
+ DCHECK(thread_);
+ thread_->stop();
+
for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
media_listeners_.end() != it;
++it) {
@@ -106,13 +103,15 @@ void StreamerAdapter::SendData(int32_t application_key,
messages_.push(msg);
}
-bool StreamerAdapter::is_app_performing_activity(int32_t application_key) {
+bool StreamerAdapter::is_app_performing_activity(
+ int32_t application_key) const {
return application_key == current_application_;
}
StreamerAdapter::Streamer::Streamer(StreamerAdapter* const adapter)
: stop_flag_(false),
adapter_(adapter) {
+ DCHECK(adapter_);
}
StreamerAdapter::Streamer::~Streamer() {
@@ -145,9 +144,9 @@ void StreamerAdapter::Streamer::threadMain() {
static int32_t messages_for_session = 0;
++messages_for_session;
- LOG4CXX_INFO(logger, "Handling map streaming message. This is "
- << messages_for_session << " message for "
- << adapter_->current_application_);
+ LOG4CXX_DEBUG(logger, "Handling map streaming message. This is "
+ << messages_for_session << " message for "
+ << adapter_->current_application_);
std::set<MediaListenerPtr>::iterator it = adapter_->media_listeners_
.begin();
for (; adapter_->media_listeners_.end() != it; ++it) {