From ed93e806a99a690fb69fa767b1afbf2ff956b511 Mon Sep 17 00:00:00 2001 From: "eojin.ham" Date: Sat, 4 May 2013 18:20:27 +0900 Subject: [PATCH] Don't do unnecessary initialization for video size. [Title] Don't do unnecessary initialization for video size. [Issue#] https://tizendev.org/bugs/browse/N_SE-37219 [Problem] Video size is initialized unnecessarily in notifyPlayerOfVideo(). [Cause] Video size was already assigned in xWindowIdPrepared(). [Solution] Don't do unnecessary initialization for video size. Change-Id: Ic70d49ab49ec905c3a65bd23b4558e1d70a59366 --- .../gstreamer/MediaPlayerPrivateGStreamer.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp index ee69bbe..e4a6218 100755 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp @@ -781,7 +781,7 @@ IntSize MediaPlayerPrivateGStreamer::naturalSize() const LOG_MEDIA_MESSAGE("Natural size: %" G_GUINT64_FORMAT "x%" G_GUINT64_FORMAT, width, height); #if ENABLE(TIZEN_ACCELERATED_COMPOSITING) && USE(TIZEN_TEXTURE_MAPPER) && ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE) && USE(ACCELERATED_VIDEO_VAAPI) - if(!m_displaySize.isEmpty()) + if (!m_displaySize.isEmpty()) m_videoSize = scaleHDVideoToDisplaySize(static_cast(width), static_cast(height), m_displaySize.width(), m_displaySize.height()); else #endif @@ -806,20 +806,24 @@ void MediaPlayerPrivateGStreamer::notifyPlayerOfVideo() m_hasVideo = videoTracks > 0; -#if ENABLE(TIZEN_ACCELERATED_COMPOSITING) && USE(TIZEN_TEXTURE_MAPPER) && ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE) - int width; - int height; +#if ENABLE(TIZEN_GSTREAMER_VIDEO) + int width, height; if (gst_video_get_size(m_videoSinkPad.get(), &width, &height)) { IntSize size(width, height); if (m_videoSize != size) { m_videoSize = IntSize(); +#if ENABLE(TIZEN_ACCELERATED_COMPOSITING) && USE(TIZEN_TEXTURE_MAPPER) && ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE) m_videoLayer->setOverlay(naturalSize()); +#endif } } -#endif + + m_player->mediaPlayerClient()->mediaPlayerEngineUpdated(m_player); +#else // ENABLE(TIZEN_GSTREAMER_VIDEO) m_videoSize = IntSize(); m_player->mediaPlayerClient()->mediaPlayerEngineUpdated(m_player); +#endif } void MediaPlayerPrivateGStreamer::audioChanged() @@ -2373,8 +2377,10 @@ IntSize MediaPlayerPrivateGStreamer::scaleHDVideoToDisplaySize(int videoWidth, i #endif void MediaPlayerPrivateGStreamer::xWindowIdPrepared(GstMessage* message) { - int videoWidth, videoHeight; + // It is called in streaming thread. + // It should be used only to set window handle to video sink. + int videoWidth, videoHeight; gst_structure_get_int(message->structure, "video-width", &videoWidth); gst_structure_get_int(message->structure, "video-height", &videoHeight); @@ -2386,6 +2392,7 @@ void MediaPlayerPrivateGStreamer::xWindowIdPrepared(GstMessage* message) int displayWidth, displayHeight; gst_structure_get_int(message->structure, "display-width", &displayWidth); gst_structure_get_int(message->structure, "display-height", &displayHeight); + m_displaySize = IntSize(displayWidth, displayHeight); m_videoSize = scaleHDVideoToDisplaySize(videoWidth, videoHeight, displayWidth, displayHeight); #else -- 2.7.4