diff options
Diffstat (limited to 'src/components/media_manager/src/audio/audio_stream_sender_thread.cc')
-rw-r--r-- | src/components/media_manager/src/audio/audio_stream_sender_thread.cc | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc index a78ca8b49c..24b12cabad 100644 --- a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc +++ b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc @@ -30,23 +30,21 @@ // POSSIBILITY OF SUCH DAMAGE. // - #if defined(OS_POSIX) && defined(OS_LINUX) #include <pthread.h> // TODO(DK): Need to remove #include <unistd.h> #endif - #include <string> #include <string.h> -#include "application_manager/application_manager_impl.h" +#include "application_manager/application_manager.h" #include "application_manager/mobile_command_factory.h" #include "application_manager/application_impl.h" #include "smart_objects/smart_object.h" #include "interfaces/MOBILE_API.h" #include "utils/file_system.h" #include "utils/logger.h" - +#include "media_manager/media_manager_settings.h" #include "media_manager/audio/audio_stream_sender_thread.h" #include "application_manager/smart_object_keys.h" #include "application_manager/message.h" @@ -57,20 +55,22 @@ using sync_primitives::AutoLock; const int32_t AudioStreamSenderThread::kAudioPassThruTimeout = 1; const uint32_t kMqueueMessageSize = 4095; -CREATE_LOGGERPTR_GLOBAL(logger_, "AudioPassThruThread") +CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager") AudioStreamSenderThread::AudioStreamSenderThread( - const std::string fileName, uint32_t session_key) - : session_key_(session_key), - fileName_(fileName), - shouldBeStoped_(false), - shouldBeStoped_lock_(), - shouldBeStoped_cv_() { + const std::string& fileName, + uint32_t session_key, + application_manager::ApplicationManager& app_mngr) + : session_key_(session_key) + , fileName_(fileName) + , shouldBeStoped_(false) + , shouldBeStoped_lock_() + , shouldBeStoped_cv_() + , application_manager_(app_mngr) { LOG4CXX_AUTO_TRACE(logger_); } -AudioStreamSenderThread::~AudioStreamSenderThread() { -} +AudioStreamSenderThread::~AudioStreamSenderThread() {} void AudioStreamSenderThread::threadMain() { LOG4CXX_AUTO_TRACE(logger_); @@ -82,7 +82,6 @@ void AudioStreamSenderThread::threadMain() { shouldBeStoped_cv_.WaitFor(auto_lock, kAudioPassThruTimeout * 1000); sendAudioChunkToMobile(); } - } void AudioStreamSenderThread::sendAudioChunkToMobile() { @@ -93,29 +92,28 @@ void AudioStreamSenderThread::sendAudioChunkToMobile() { std::vector<uint8_t>::iterator to; if (!file_system::ReadBinaryFile(fileName_, binaryData)) { - LOG4CXX_ERROR_EXT(logger_, "Unable to read file." << fileName_); + LOG4CXX_ERROR(logger_, "Unable to read file." << fileName_); return; } if (binaryData.empty()) { - LOG4CXX_ERROR_EXT(logger_, "Binary data is empty."); + LOG4CXX_ERROR(logger_, "Binary data is empty."); return; } - LOG4CXX_INFO_EXT(logger_, "offset = " << offset_); + LOG4CXX_INFO(logger_, "offset = " << offset_); from = binaryData.begin() + offset_; to = binaryData.end(); if (from < binaryData.end() /*from != binaryData.end()*/) { - LOG4CXX_INFO_EXT(logger_, "from != binaryData.end()"); + LOG4CXX_INFO(logger_, "from != binaryData.end()"); offset_ = offset_ + to - from; std::vector<uint8_t> data(from, to); - application_manager::ApplicationManagerImpl::instance()-> - SendAudioPassThroughNotification(session_key_, data); + application_manager_.SendAudioPassThroughNotification(session_key_, data); binaryData.clear(); } #if !defined(EXTENDED_MEDIA_MODE) |