summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2016-10-12 11:32:16 -0400
committerJacob Keeler <jacob.keeler@livioradio.com>2016-10-12 11:32:16 -0400
commitcb7972dba3c3da665ce779cf8b78ef83bfefc256 (patch)
tree29a0076d06afc12a4d6ed304bd4e8ed4b92e01b7
parentf66ea1daedf14e932a1d76f91d66bd775b6a1309 (diff)
downloadsdl_core-hotfix/fix_EXTENDED_MEDIA_MODE.tar.gz
Fix SEGFAULT in media_manager_impl.cc when EXTENDED_MEDIA_MODE=ONhotfix/fix_EXTENDED_MEDIA_MODE
media_manager_impl.cc tries to make an A2DPSourcePlayerAdapter using the protocol handler before it is set, causing the program to SEGFAULT. This commit moves this creation to the PlayA2DPSource method and adds an explicit check to make sure that the protocol handler is set beforehand.
-rw-r--r--src/components/media_manager/src/media_manager_impl.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc
index e531894b27..b89fc4c71f 100644
--- a/src/components/media_manager/src/media_manager_impl.cc
+++ b/src/components/media_manager/src/media_manager_impl.cc
@@ -114,8 +114,6 @@ void MediaManagerImpl::Init() {
#if defined(EXTENDED_MEDIA_MODE)
LOG4CXX_INFO(logger_, "Called Init with default configuration.");
- a2dp_player_ =
- new A2DPSourcePlayerAdapter(protocol_handler_->get_session_observer());
from_mic_recorder_ = new FromMicRecorderAdapter();
#endif
@@ -157,6 +155,14 @@ void MediaManagerImpl::Init() {
void MediaManagerImpl::PlayA2DPSource(int32_t application_key) {
LOG4CXX_AUTO_TRACE(logger_);
+
+#if defined(EXTENDED_MEDIA_MODE)
+ if (!a2dp_player_ && protocol_handler_) {
+ a2dp_player_ =
+ new A2DPSourcePlayerAdapter(protocol_handler_->get_session_observer());
+ }
+#endif
+
if (a2dp_player_) {
a2dp_player_->StartActivity(application_key);
}