Add murphy support to audio session manager. 62/9862/4
authorJaska Uimonen <jaska.uimonen@helsinki.fi>
Thu, 29 Aug 2013 07:25:00 +0000 (10:25 +0300)
committerJoone Hur <joone.hur@intel.com>
Fri, 20 Sep 2013 13:22:09 +0000 (06:22 -0700)
Enable audio policy preemtion with web apps
with configuration flags (possibly for different
verticals). First there are conditionals to spec
file to enable asm and Murphy support to be compiled
in. Main item is a separate function to enable asm
to work with Murphy. So you will have 3 choices:
no policy, asm or asm with Murphy. For example:
PC -> nothing defined, mobile -> asm defined,
IVI -> asm and asm with murphy defined.

Change-Id: I6b44335e17cef8957cc8cf6c8a6c63c778386a2c

Source/WebCore/platform/audio/gstreamer/tizen/AudioSessionManagerGStreamerTizen.cpp
Source/WebCore/platform/audio/gstreamer/tizen/AudioSessionManagerGStreamerTizen.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/cmake/OptionsTizen.cmake
packaging/webkit2-efl.spec

index 82b1b55..f25f4fe 100644 (file)
@@ -143,5 +143,12 @@ ASM_sound_events_t AudioSessionManagerGStreamerTizen::interpretSessionToEvent(MM
         return ASM_EVENT_NONE;
     }
 }
+
+int AudioSessionManagerGStreamerTizen::getAsmHandle()
+{
+   return m_handle;
 }
+
+}
+
 #endif
index 3da2e47..423adcd 100644 (file)
@@ -59,6 +59,7 @@ public:
     int getSoundState(ASM_sound_states_t*);
     bool setSoundState(ASM_sound_states_t);
     ASM_sound_events_t interpretSessionToEvent(MMSessionType);
+    int getAsmHandle();
 
 private:
     AudioSessionManagerGStreamerTizen();
index 1530578..d26c4d1 100755 (executable)
@@ -2290,13 +2290,43 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin()
         g_object_set(m_playBin.get(), "video-sink", fakeSink, NULL);
     }
 #endif
+
 #if ENABLE(TIZEN_AUDIO_SESSION_MANAGER)
+#if (!ENABLE(TIZEN_AUDIO_SESSION_MANAGER_WITH_MURPHY))
     GstElement* realSink = gst_element_factory_make("avsysaudiosink", 0);
     g_object_set(realSink, "close-handle-on-prepare", 1, NULL);
     g_object_set(m_playBin.get(), "audio-sink", realSink, NULL);
-
+#endif
     if (m_audioSessionManager)
         m_audioSessionManager->registerAudioSessionManager(MM_SESSION_TYPE_SHARE, mediaPlayerPrivateAudioSessionNotifyCallback, player());
+#if ENABLE(TIZEN_AUDIO_SESSION_MANAGER_WITH_MURPHY)
+    GstElement *sink = gst_element_factory_make("pulsesink", "audio-sink");
+    if (sink != NULL) {
+        GstStructure *props;
+        FILE *f;
+        guint32 ids[256];
+        guint32 rsetid = 0;
+        GOwnPtr<gchar> filename;
+        GOwnPtr<gchar> propname;
+
+        filename.set(g_strdup_printf("/tmp/murphy/mapping-file-%d", getpid()));
+
+        if ((f = fopen(filename.get(), "r"))) {
+            if (fread((void *)ids, sizeof(guint32), 256, f) == 256)
+                rsetid = ids[(m_audioSessionManager->getAsmHandle() & 0xff)];
+
+            fclose(f);
+        }
+
+        propname.set(g_strdup_printf("props,resource.set.id=(string)%u,media.role=%s", rsetid, "browser"));
+
+        props = gst_structure_from_string(propname.get(), NULL);
+        g_object_set(sink, "stream-properties", props, NULL);
+        gst_structure_free(props);
+
+        g_object_set(m_playBin.get(), "audio-sink", sink, NULL);
+    }
+#endif
 #else
     createAudioSink();
 #endif
index 96d646a..059edbe 100644 (file)
@@ -124,6 +124,10 @@ WEBKIT_OPTION_DEFINE(ENABLE_TIZEN_AUDIO_SESSION_MANAGER "Audio Session Manager S
     #      nor also would be wished the audio session manager.
     #      This option controls whether the audio session manager is integrated or not.
 
+WEBKIT_OPTION_DEFINE(ENABLE_TIZEN_AUDIO_SESSION_MANAGER_WITH_MURPHY "Audio Session Manager with Murphy Support" OFF)
+    # - ENABLE_TIZEN_AUDIO_SESSION_MANAGER_WITH_MURPHY: This option controls if
+    #      audio session manager is compiled to use Murphy engine or not.
+
 WEBKIT_OPTION_DEFINE(ENABLE_TIZEN_GSTREAMER_VIDEO_SET_SINK "Use of a webkit provided video sink for gstreamer" OFF)
     # - ENABLE_TIZEN_GSTREAMER_VIDEO_SET_SINK: The behaviour of this option is frankly
     #      complicated and its name isn't obvious. For some TIZEN targets, the treatment
@@ -364,6 +368,9 @@ IF (ENABLE_WEB_AUDIO)
     ENDIF()
     SET(WTF_USE_GSTREAMER 1)
     ADD_DEFINITIONS(-DWTF_USE_GSTREAMER=1)
+    IF (ENABLE_TIZEN_AUDIO_SESSION_MANAGER_WITH_MURPHY)
+    ADD_DEFINITIONS(-DENABLE_TIZEN_AUDIO_SESSION_MANAGER_WITH_MURPHY=1)
+    ENDIF ()
 
     LIST(APPEND GSTREAMER_COMPONENTS audio fft)
 
index 45234da..ba865ac 100644 (file)
@@ -1,6 +1,8 @@
 %bcond_with mesa
 %bcond_with wayland
 %bcond_with desktop
+%bcond_with audio_session_manager
+%bcond_with audio_session_manager_with_murphy
 Name: webkit2-efl
 Summary: Webkit2 EFL
 Version: 123997_0.11.47
@@ -166,6 +168,9 @@ then
        -DENABLE_ALLINONE=On \
 %if %{with audio_session_manager}
        -DENABLE_TIZEN_AUDIO_SESSION_MANAGER=On \
+%if %{with audio_session_manager_with_murphy}
+       -DENABLE_TIZEN_AUDIO_SESSION_MANAGER_WITH_MURPHY=On \
+%endif
 %endif
        -DENABLE_TIZEN_SCREEN_READER=Off \
        -DEFL_TARGET=%{EFL_TARGET} \