Changeset 243644 in webkit
- Timestamp:
- Mar 29, 2019 3:43:30 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r243643 r243644 1 2019-03-29 Philippe Normand <pnormand@igalia.com> 2 3 [GStreamer] imxvpudecoder detection and handling 4 https://bugs.webkit.org/show_bug.cgi?id=196346 5 6 Reviewed by Xabier Rodriguez-Calvar. 7 8 When the imxvpudecoder is used, the texture sampling of the 9 directviv-uploaded texture returns an RGB value, so there's no need 10 to convert it. This patch also includes a refactoring of the 11 ImageRotation flag handling. The flag is now computed once only 12 and stored in an instance variable. 13 14 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: 15 (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): 16 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: 17 (WebCore::GstVideoFrameHolder::GstVideoFrameHolder): 18 (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): 19 (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor): 20 (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer): 21 (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture): 22 (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime): 23 (WebCore::MediaPlayerPrivateGStreamerBase::setVideoSourceOrientation): 24 (WebCore::MediaPlayerPrivateGStreamerBase::updateTextureMapperFlags): 25 (WebCore::texMapFlagFromOrientation): Deleted. 26 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 27 1 28 2019-03-29 Cathie Chen <cathiechen@igalia.com> 2 29 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
r243610 r243644 2393 2393 2394 2394 GUniquePtr<char> elementName(gst_element_get_name(element)); 2395 player->m_isVideoDecoderVideo4Linux = g_str_has_prefix(elementName.get(), "v4l2"); 2395 if (g_str_has_prefix(elementName.get(), "v4l2")) 2396 player->m_videoDecoderPlatform = WebKitGstVideoDecoderPlatform::Video4Linux; 2397 else if (g_str_has_prefix(elementName.get(), "imxvpudecoder")) 2398 player->m_videoDecoderPlatform = WebKitGstVideoDecoderPlatform::ImxVPU; 2399 2400 player->updateTextureMapperFlags(); 2396 2401 }), this); 2397 2402 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
r243538 r243644 120 120 #include "GraphicsContext3D.h" 121 121 #include "TextureMapperContextAttributes.h" 122 #include "TextureMapperGL.h"123 122 #include "TextureMapperPlatformLayerBuffer.h" 124 123 #include "TextureMapperPlatformLayerProxy.h" … … 149 148 return ABS(a); 150 149 } 151 152 #if USE(TEXTURE_MAPPER_GL)153 static inline TextureMapperGL::Flags texMapFlagFromOrientation(const ImageOrientation& orientation)154 {155 switch (orientation) {156 case DefaultImageOrientation:157 return 0;158 case OriginRightTop:159 return TextureMapperGL::ShouldRotateTexture90;160 case OriginBottomRight:161 return TextureMapperGL::ShouldRotateTexture180;162 case OriginLeftBottom:163 return TextureMapperGL::ShouldRotateTexture270;164 default:165 ASSERT_NOT_REACHED();166 }167 168 return 0;169 }170 #endif171 150 172 151 #if USE(TEXTURE_MAPPER_GL) … … 186 165 187 166 #if USE(GSTREAMER_GL) 188 m_flags = flags | (m_hasAlphaChannel ? TextureMapperGL::ShouldBlend : 0) | TEXTURE_MAPPER_COLOR_CONVERT_FLAG;167 m_flags = flags | (m_hasAlphaChannel ? TextureMapperGL::ShouldBlend : 0); 189 168 190 169 if (gstGLEnabled) { … … 275 254 { 276 255 #if USE(GSTREAMER_GL) 277 if (m_ isVideoDecoderVideo4Linux)256 if (m_videoDecoderPlatform == WebKitGstVideoDecoderPlatform::Video4Linux) 278 257 flushCurrentBuffer(); 279 258 #endif … … 734 713 return; 735 714 736 std::unique_ptr<GstVideoFrameHolder> frameHolder = std::make_unique<GstVideoFrameHolder>(m_sample.get(), texMapFlagFromOrientation(m_videoSourceOrientation), !m_usingFallbackVideoSink);715 std::unique_ptr<GstVideoFrameHolder> frameHolder = std::make_unique<GstVideoFrameHolder>(m_sample.get(), m_textureMapperFlags, !m_usingFallbackVideoSink); 737 716 738 717 GLuint textureID = frameHolder->textureID(); … … 749 728 } 750 729 frameHolder->updateTexture(layerBuffer->textureGL()); 751 layerBuffer->setExtraFlags( texMapFlagFromOrientation(m_videoSourceOrientation)| (frameHolder->hasAlphaChannel() ? TextureMapperGL::ShouldBlend : 0));730 layerBuffer->setExtraFlags(m_textureMapperFlags | (frameHolder->hasAlphaChannel() ? TextureMapperGL::ShouldBlend : 0)); 752 731 } 753 732 proxy.pushNextBuffer(WTFMove(layerBuffer)); … … 875 854 } 876 855 877 auto proxyOperation = 878 [shouldWait = m_isVideoDecoderVideo4Linux, pipeline = pipeline()](TextureMapperPlatformLayerProxy& proxy) 879 { 880 GST_DEBUG_OBJECT(pipeline, "Flushing video sample %s", shouldWait ? "synchronously" : ""); 881 LockHolder locker(!shouldWait ? &proxy.lock() : nullptr); 882 883 if (proxy.isActive()) 884 proxy.dropCurrentBufferWhilePreservingTexture(shouldWait); 885 }; 856 bool shouldWait = m_videoDecoderPlatform == WebKitGstVideoDecoderPlatform::Video4Linux; 857 auto proxyOperation = [shouldWait, pipeline = pipeline()](TextureMapperPlatformLayerProxy& proxy) { 858 GST_DEBUG_OBJECT(pipeline, "Flushing video sample %s", shouldWait ? "synchronously" : ""); 859 LockHolder locker(!shouldWait ? &proxy.lock() : nullptr); 860 861 if (proxy.isActive()) 862 proxy.dropCurrentBufferWhilePreservingTexture(shouldWait); 863 }; 886 864 887 865 #if USE(NICOSIA) … … 937 915 return false; 938 916 939 std::unique_ptr<GstVideoFrameHolder> frameHolder = std::make_unique<GstVideoFrameHolder>(m_sample.get(), texMapFlagFromOrientation(m_videoSourceOrientation), true);917 std::unique_ptr<GstVideoFrameHolder> frameHolder = std::make_unique<GstVideoFrameHolder>(m_sample.get(), m_textureMapperFlags, true); 940 918 941 919 auto textureID = frameHolder->textureID(); … … 964 942 return nullptr; 965 943 966 std::unique_ptr<GstVideoFrameHolder> frameHolder = std::make_unique<GstVideoFrameHolder>(m_sample.get(), texMapFlagFromOrientation(m_videoSourceOrientation), true);944 std::unique_ptr<GstVideoFrameHolder> frameHolder = std::make_unique<GstVideoFrameHolder>(m_sample.get(), m_textureMapperFlags, true); 967 945 968 946 auto textureID = frameHolder->textureID(); … … 996 974 997 975 m_videoSourceOrientation = orientation; 998 } 976 #if USE(TEXTURE_MAPPER_GL) 977 updateTextureMapperFlags(); 978 #endif 979 } 980 981 #if USE(TEXTURE_MAPPER_GL) 982 void MediaPlayerPrivateGStreamerBase::updateTextureMapperFlags() 983 { 984 switch (m_videoSourceOrientation) { 985 case DefaultImageOrientation: 986 m_textureMapperFlags = 0; 987 break; 988 case OriginRightTop: 989 m_textureMapperFlags = TextureMapperGL::ShouldRotateTexture90; 990 break; 991 case OriginBottomRight: 992 m_textureMapperFlags = TextureMapperGL::ShouldRotateTexture180; 993 break; 994 case OriginLeftBottom: 995 m_textureMapperFlags = TextureMapperGL::ShouldRotateTexture270; 996 break; 997 default: 998 // FIXME: Handle OriginTopRight, OriginBottomLeft, OriginLeftTop and OriginRightBottom? 999 m_textureMapperFlags = 0; 1000 break; 1001 } 1002 1003 // When the imxvpudecoder is used, the texture sampling of the 1004 // directviv-uploaded texture returns an RGB value, so there's no need to 1005 // convert it. 1006 if (m_videoDecoderPlatform != WebKitGstVideoDecoderPlatform::ImxVPU) 1007 m_textureMapperFlags |= TEXTURE_MAPPER_COLOR_CONVERT_FLAG; 1008 } 1009 #endif 999 1010 1000 1011 bool MediaPlayerPrivateGStreamerBase::supportsFullscreen() const -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h
r242793 r243644 39 39 40 40 #if USE(TEXTURE_MAPPER_GL) 41 #include "TextureMapperGL.h" 41 42 #if USE(NICOSIA) 42 43 #include "NicosiaContentLayerTextureMapperImpl.h" … … 222 223 static void muteChangedCallback(MediaPlayerPrivateGStreamerBase*); 223 224 225 #if USE(TEXTURE_MAPPER_GL) 226 void updateTextureMapperFlags(); 227 TextureMapperGL::Flags m_textureMapperFlags; 228 #endif 229 224 230 enum MainThreadNotification { 225 231 VideoChanged = 1 << 0, … … 284 290 #endif 285 291 286 mutable bool m_isVideoDecoderVideo4Linux { false }; 292 enum class WebKitGstVideoDecoderPlatform { ImxVPU, Video4Linux }; 293 294 WebKitGstVideoDecoderPlatform m_videoDecoderPlatform; 287 295 }; 288 296
Note: See TracChangeset
for help on using the changeset viewer.