[Title] Volume key senario has been applied for media element and webaudio.
[Problem] DCM-1102
[Cause] N/A
[Solution] N/A
Change-Id: Ib1c2a5da00aaccad87b3cdda492701b26517ae5f
// It's not that useful to have a callback function for this since the audio thread automatically starts rendering on the graph
// when this has finished (see AudioDestinationNode).
m_hrtfDatabaseLoader = HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(sampleRate());
+
+#if ENABLE(TIZEN_GSTREAMER_AUDIO)
+ document->incrementActiveMediaObjectCount();
+#endif
}
// Constructor for offline (non-realtime) rendering.
return;
#if ENABLE(TIZEN_WEB_AUDIO)
- m_isInitialized = false;
+ m_isInitialized = false;
#endif
// This stops the audio thread and all audio rendering.
// Usually ScriptExecutionContext calls stop twice.
if (m_isStopScheduled)
return;
+#if ENABLE(TIZEN_GSTREAMER_AUDIO)
+ Document* document = static_cast<Document*>(scriptExecutionContext());
+ if (!isOfflineContext())
+ document->decrementActiveMediaObjectCount();
+#endif
m_isStopScheduled = true;
// Don't call uninitialize() immediately here because the ScriptExecutionContext is in the middle
${LevelDB_INCLUDE_DIRS}
${LevelDB-MemEnv_INCLUDE_DIRS}
${Libavcodec_INCLUDE_DIR}
+ ${MMSOUND_INCLUDE_DIRS}
${MM-Player_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIRS}
${Pmapi_INCLUDE_DIRS}
${LevelDB_LIBRARIES}
${LevelDB-MemEnv_LIBRARIES}
${Libavcodec_LIBS}
+ ${MMSOUND_LIBRARIES}
${MM-Player_LIBRARIES}
${OPENSSL_LIBRARIES}
${Pmapi_LIBRARIES}
#include "TizenExtensibleAPI.h"
#endif
+#if ENABLE(TIZEN_GSTREAMER_AUDIO)
+#include "AudioSessionManagerGStreamerTizen.h"
+#endif
+
using namespace std;
using namespace WTF;
using namespace Unicode;
#ifndef NDEBUG
, m_didDispatchViewportPropertiesChanged(false)
#endif
+#if ENABLE(TIZEN_GSTREAMER_AUDIO)
+ , m_activeMediaObjectCount(0)
+#endif
{
m_document = this;
void Document::dispatchVisibilityStateChangeEvent()
{
+#if ENABLE(TIZEN_GSTREAMER_AUDIO)
+ if (m_activeMediaObjectCount) {
+ if (!webkitHidden())
+ AudioSessionManagerGStreamerTizen::setVolumeSessionToMediaType();
+ else
+ AudioSessionManagerGStreamerTizen::clearVolumeSessionFromMediaType();
+ }
+#endif
dispatchEvent(Event::create(eventNames().webkitvisibilitychangeEvent, false, false));
}
#endif
}
#endif
+#if ENABLE(TIZEN_GSTREAMER_AUDIO)
+void Document::incrementActiveMediaObjectCount()
+{
+ if (!m_activeMediaObjectCount)
+ AudioSessionManagerGStreamerTizen::setVolumeSessionToMediaType();
+ atomicIncrement(&m_activeMediaObjectCount);
+}
+
+void Document::decrementActiveMediaObjectCount()
+{
+ atomicDecrement(&m_activeMediaObjectCount);
+ if (!m_activeMediaObjectCount)
+ AudioSessionManagerGStreamerTizen::clearVolumeSessionFromMediaType();
+}
+#endif
} // namespace WebCore
String webkitVisibilityState() const;
bool webkitHidden() const;
void dispatchVisibilityStateChangeEvent();
+#if ENABLE(TIZEN_GSTREAMER_AUDIO)
+ void incrementActiveMediaObjectCount();
+ void decrementActiveMediaObjectCount();
+#endif
#endif
#if ENABLE(CSP_NEXT)
#ifndef NDEBUG
bool m_didDispatchViewportPropertiesChanged;
#endif
+#if ENABLE(TIZEN_GSTREAMER_AUDIO)
+ int m_activeMediaObjectCount;
+#endif
};
// Put these methods here, because they require the Document definition, but we really want to inline them.
setHasCustomCallbacks();
addElementToDocumentMap(this, document);
+
+#if ENABLE(TIZEN_GSTREAMER_AUDIO)
+ document->incrementActiveMediaObjectCount();
+#endif
}
HTMLMediaElement::~HTMLMediaElement()
m_completelyLoaded = true;
if (m_player)
m_player->clearMediaPlayerClient();
+
+#if ENABLE(TIZEN_GSTREAMER_AUDIO)
+ document()->decrementActiveMediaObjectCount();
+#endif
}
void HTMLMediaElement::didMoveToNewDocument(Document* oldDocument)
else if (attribute.name() == loopAttr)
updateDisableSleep();
#endif
-#if ENABLE(TIZEN_MEDIA_STREAM)
+#if ENABLE(TIZEN_GSTREAMER_AUDIO)
else if (attribute.name() == mutedAttr)
m_muted = true;
#endif
m_player->setPreload(m_preload);
m_player->setPreservesPitch(m_webkitPreservesPitch);
-#if !ENABLE(TIZEN_MEDIA_STREAM)
+#if !ENABLE(TIZEN_GSTREAMER_AUDIO)
if (fastHasAttribute(mutedAttr))
m_muted = true;
updateVolume();
if (!m_player->load(url, contentType, keySystem))
mediaLoadingFailed(MediaPlayer::FormatError);
-#if ENABLE(TIZEN_MEDIA_STREAM)
+#if ENABLE(TIZEN_GSTREAMER_AUDIO)
updateVolume();
#endif
m_audioSinkAvailable = false;
return;
}
+#if ENABLE(TIZEN_WEB_AUDIO)
+ GValue value;
+ g_value_set_boolean(&value, true);
+ gst_child_proxy_set_property(GST_OBJECT(audioSink.get()), "close-handle-on-prepare", &value);
+#endif
GstElement* audioConvert = gst_element_factory_make("audioconvert", 0);
gst_bin_add_many(GST_BIN(m_pipeline), audioConvert, audioSink.get(), NULL);
#if ENABLE(TIZEN_GSTREAMER_AUDIO)
#include <unistd.h>
+#include <mm_sound.h>
+#if ENABLE(TIZEN_EXTENSIBLE_API)
+#include "TizenExtensibleAPI.h"
+#endif
+
+namespace WebCore {
+void AudioSessionManagerGStreamerTizen::setVolumeSessionToMediaType()
+{
+ volume_type_t volumeType;
+#if ENABLE(TIZEN_EXTENSIBLE_API)
+ if (TizenExtensibleAPI::extensibleAPI().mediaStreamRecord()) {
+ mm_sound_volume_get_current_playing_type(&volumeType);
+ if (volumeType != VOLUME_TYPE_MEDIA)
+ mm_sound_volume_primary_type_set(VOLUME_TYPE_MEDIA);
+ }
+#endif
+}
+
+void AudioSessionManagerGStreamerTizen::clearVolumeSessionFromMediaType()
+{
+#if ENABLE(TIZEN_EXTENSIBLE_API)
+ if (TizenExtensibleAPI::extensibleAPI().mediaStreamRecord())
+ mm_sound_volume_primary_type_clear();
+#endif
+}
+\r
AudioSessionManagerGStreamerTizen::AudioSessionManagerGStreamerTizen()
: m_eventType(ASM_EVENT_NONE)
, m_handle(-1)
return ASM_EVENT_NONE;
}
}
+}
#endif
#include <mm_session_private.h>
#include <wtf/Forward.h>
-using namespace WebCore;
+namespace WebCore {
class AudioSessionManagerGStreamerTizen : public RefCounted<AudioSessionManagerGStreamerTizen> {
public:
return adoptRef(new AudioSessionManagerGStreamerTizen());
}
+ static void setVolumeSessionToMediaType();
+ static void clearVolumeSessionFromMediaType();
+
~AudioSessionManagerGStreamerTizen();
bool registerAudioSessionManager(MMSessionType, ASM_sound_cb_t, void*);
MMSessionType m_sessionType;
ASM_sound_states_t m_stateType;
};
+}
#endif
#endif
, m_encryptDatabase(false)
, m_fullScreen(false)
, m_mediaStreamRecord(false)
+ , m_mediaVolumeControl(false)
, m_rotateCameraView(true)
{
}
case MediaStreamRecord:
m_mediaStreamRecord = enable;
break;
+ case MediaVolumeControl:
+ m_mediaVolumeControl = enable;
+ break;
case RotateCameraView:
m_rotateCameraView = enable;
break;
EncryptionDatabase,
FullScreen,
MediaStreamRecord,
+ MediaVolumeControl,
RotateCameraView
};
typedef enum _ExtensibleAPI ExtensibleAPI;
bool encryptDatabase() const { return m_encryptDatabase; }
bool fullScreen() const { return m_fullScreen; }
bool mediaStreamRecord() const { return m_mediaStreamRecord; }
+ bool mediaVolumeControl() const { return m_mediaVolumeControl; }
bool rotateCameraView() const { return m_rotateCameraView; }
void setTizenExtensibleAPI(ExtensibleAPI, bool enable);
bool m_encryptDatabase;
bool m_fullScreen;
bool m_mediaStreamRecord;
+ bool m_mediaVolumeControl;
bool m_rotateCameraView;
};
m_playBin = 0;
}
+ m_player = 0;
+
#if ENABLE(TIZEN_GSTREAMER_AUDIO)
if (m_audioSessionManager)
m_audioSessionManager->setSoundState(ASM_STATE_STOP);
#endif
- m_player = 0;
-
if (m_muteTimerHandler)
g_source_remove(m_muteTimerHandler);
g_object_set(m_playBin.get(), "video-sink", fakeSink, NULL);
}
#endif
-
-#if ENABLE(TIZEN_GSTREAMER_AUDIO)
- if (m_audioSessionManager)
- m_audioSessionManager->registerAudioSessionManager(MM_SESSION_TYPE_SHARE, mediaPlayerPrivateAudioSessionNotifyCallback, player());
-#endif
-
#if ENABLE(TIZEN_GSTREAMER_AUDIO)
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);
+
+ if (m_audioSessionManager)
+ m_audioSessionManager->registerAudioSessionManager(MM_SESSION_TYPE_SHARE, mediaPlayerPrivateAudioSessionNotifyCallback, player());
#else
createAudioSink();
#endif
kWKTizenExtensibleAPIEncryptionDatabase,
kWKTizenExtensibleAPIFullScreen,
kWKTizenExtensibleAPIMediaStreamRecord,
+ kWKTizenExtensibleAPIMediaVolumeControl,
kWKTizenExtensibleAPIRotateCameraView
};
typedef uint32_t WKTizenExtensibleAPI;
EWK_EXTENSIBLE_API_ENCRYPTION_DATABASE,
EWK_EXTENSIBLE_API_FULL_SCREEN,
EWK_EXTENSIBLE_API_MEDIA_STREAM_RECORD,
+ EWK_EXTENSIBLE_API_MEDIA_VOLUME_CONTROL,
EWK_EXTENSIBLE_API_ROTATE_CAMERA_VIEW
};
/// Creates a type name for @a _Ewk_Extensible_API.
FIND_PACKAGE(GStreamer REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
FIND_PACKAGE(ASM REQUIRED)
FIND_PACKAGE(SESSION REQUIRED)
+ FIND_PACKAGE(MMSOUND REQUIRED)
SET(WTF_USE_GSTREAMER 1)
ADD_DEFINITIONS(-DWTF_USE_GSTREAMER=1)
BuildRequires: pkgconfig(mmutil-imgp)
BuildRequires: pkgconfig(mmutil-jpeg)
BuildRequires: pkgconfig(mm-session)
+BuildRequires: pkgconfig(mm-sound)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(utilX)
BuildRequires: pkgconfig(vconf)