Changeset 152711 in webkit
- Timestamp:
- Jul 16, 2013 3:16:46 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r152710 r152711 1 2013-07-16 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> 2 3 [texmap][GStreamer] upload onto the texture only the buffer to be painted 4 https://bugs.webkit.org/show_bug.cgi?id=118471 5 6 Reviewed by Philippe Normand. 7 8 Right now all the buffers are uploaded onto the texture. With this 9 logic pose situations where buffers that will not be painted are 10 uploaded. 11 12 This patch uploads only the buffers that are going to be shown. 13 14 With this approach, the buffers may arrive before a GraphicsLayer is 15 set, so we should be more cautious with GraphicsLayerTextureMapper's 16 client. 17 18 No new tests, covered by existing tests. 19 20 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: 21 (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase): 22 (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture): 23 (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): 24 (WebCore::MediaPlayerPrivateGStreamerBase::paint): 25 (WebCore::MediaPlayerPrivateGStreamerBase::paintToTextureMapper): 26 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 27 * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: 28 (WebCore::GraphicsLayerTextureMapper::~GraphicsLayerTextureMapper): 29 (WebCore::GraphicsLayerTextureMapper::setContentsToMedia): 30 1 31 2013-07-16 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> 2 32 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
r151733 r152711 116 116 , m_volumeSignalHandler(0) 117 117 , m_muteSignalHandler(0) 118 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS)119 , m_texture(0)120 #endif121 118 { 122 119 #if GLIB_CHECK_VERSION(2, 31, 0) … … 326 323 327 324 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS) 328 void MediaPlayerPrivateGStreamerBase::updateTexture(GstBuffer* buffer)329 { 330 if (!m_texture)331 return;332 333 if (!client())334 return;325 PassRefPtr<BitmapTexture> MediaPlayerPrivateGStreamerBase::updateTexture(TextureMapper* textureMapper) 326 { 327 g_mutex_lock(m_bufferMutex); 328 if (!m_buffer) { 329 g_mutex_unlock(m_bufferMutex); 330 return 0; 331 } 335 332 336 333 const void* srcData = 0; … … 338 335 GRefPtr<GstCaps> caps = currentVideoSinkCaps(); 339 336 #else 340 GRefPtr<GstCaps> caps = GST_BUFFER_CAPS(buffer); 341 #endif 342 if (!caps) 343 return; 337 GRefPtr<GstCaps> caps = GST_BUFFER_CAPS(m_buffer); 338 #endif 339 if (!caps) { 340 g_mutex_unlock(m_bufferMutex); 341 return 0; 342 } 344 343 345 344 IntSize size; 346 345 GstVideoFormat format; 347 346 int pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride; 348 if (!getVideoSizeAndFormatFromCaps(caps.get(), size, format, pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride)) 349 return; 350 351 if (m_texture->size() != size) 352 m_texture->reset(size); 347 if (!getVideoSizeAndFormatFromCaps(caps.get(), size, format, pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride)) { 348 g_mutex_unlock(m_bufferMutex); 349 return 0; 350 } 351 352 RefPtr<BitmapTexture> texture = textureMapper->acquireTextureFromPool(size); 353 353 354 354 #if GST_CHECK_VERSION(1, 1, 0) 355 355 GstVideoGLTextureUploadMeta* meta; 356 if ((meta = gst_buffer_get_video_gl_texture_upload_meta( buffer))) {356 if ((meta = gst_buffer_get_video_gl_texture_upload_meta(m_buffer))) { 357 357 if (meta->n_textures == 1) { // BRGx & BGRA formats use only one texture. 358 const BitmapTextureGL* textureGL = static_cast<const BitmapTextureGL*>( m_texture.get());358 const BitmapTextureGL* textureGL = static_cast<const BitmapTextureGL*>(texture.get()); 359 359 guint ids[4] = { textureGL->id(), 0, 0, 0 }; 360 360 361 361 if (gst_video_gl_texture_upload_meta_upload(meta, ids)) { 362 client()->setPlatformLayerNeedsDisplay();363 return ;362 g_mutex_unlock(m_bufferMutex); 363 return texture; 364 364 } 365 365 } … … 369 369 #ifdef GST_API_VERSION_1 370 370 GstMapInfo srcInfo; 371 gst_buffer_map( buffer, &srcInfo, GST_MAP_READ);371 gst_buffer_map(m_buffer, &srcInfo, GST_MAP_READ); 372 372 srcData = srcInfo.data; 373 373 #else 374 srcData = GST_BUFFER_DATA( buffer);375 #endif 376 377 m_texture->updateContents(srcData, WebCore::IntRect(WebCore::IntPoint(0, 0), size), WebCore::IntPoint(0, 0), stride, BitmapTexture::UpdateCannotModifyOriginalImageData);374 srcData = GST_BUFFER_DATA(m_buffer); 375 #endif 376 377 texture->updateContents(srcData, WebCore::IntRect(WebCore::IntPoint(0, 0), size), WebCore::IntPoint(0, 0), stride, BitmapTexture::UpdateCannotModifyOriginalImageData); 378 378 379 379 #ifdef GST_API_VERSION_1 380 gst_buffer_unmap(buffer, &srcInfo); 381 #endif 382 383 client()->setPlatformLayerNeedsDisplay(); 380 gst_buffer_unmap(m_buffer, &srcInfo); 381 #endif 382 383 g_mutex_unlock(m_bufferMutex); 384 return texture; 384 385 } 385 386 #endif … … 389 390 g_return_if_fail(GST_IS_BUFFER(buffer)); 390 391 392 g_mutex_lock(m_bufferMutex); 393 gst_buffer_replace(&m_buffer, buffer); 394 g_mutex_unlock(m_bufferMutex); 395 391 396 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS) 392 if (supportsAcceleratedRendering() && m_player->mediaPlayerClient()->mediaPlayerRenderingCanBeAccelerated(m_player)) 393 updateTexture(buffer); 394 else 395 #endif 396 { 397 g_mutex_lock(m_bufferMutex); 398 gst_buffer_replace(&m_buffer, buffer); 399 g_mutex_unlock(m_bufferMutex); 400 m_player->repaint(); 401 } 397 if (supportsAcceleratedRendering() && m_player->mediaPlayerClient()->mediaPlayerRenderingCanBeAccelerated(m_player) && client()) { 398 client()->setPlatformLayerNeedsDisplay(); 399 return; 400 } 401 #endif 402 403 m_player->repaint(); 402 404 } 403 405 … … 410 412 { 411 413 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS) 412 if ( m_texture)414 if (client()) 413 415 return; 414 416 #endif … … 456 458 return; 457 459 458 if (!m_texture) { 459 m_texture = textureMapper->acquireTextureFromPool(naturalSize()); 460 return; 461 } 462 463 textureMapper->drawTexture(*m_texture.get(), targetRect, matrix, opacity); 460 RefPtr<BitmapTexture> texture = updateTexture(textureMapper); 461 if (texture) 462 textureMapper->drawTexture(*texture.get(), targetRect, matrix, opacity); 464 463 } 465 464 #endif -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h
r151728 r152711 138 138 mutable IntSize m_videoSize; 139 139 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS) 140 void updateTexture(GstBuffer*); 141 RefPtr<BitmapTexture> m_texture; 140 PassRefPtr<BitmapTexture> updateTexture(TextureMapper*); 142 141 #endif 143 142 }; -
trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
r149813 r152711 78 78 GraphicsLayerTextureMapper::~GraphicsLayerTextureMapper() 79 79 { 80 if (m_contentsLayer) 81 m_contentsLayer->setClient(0); 82 80 83 willBeDestroyed(); 81 84 } … … 385 388 GraphicsLayer::setContentsToMedia(media); 386 389 notifyChange(ContentChange); 390 391 if (m_contentsLayer) 392 m_contentsLayer->setClient(0); 393 387 394 m_contentsLayer = media; 388 395 389 m_contentsLayer->setClient(this); 396 if (m_contentsLayer) 397 m_contentsLayer->setClient(this); 390 398 } 391 399
Note: See TracChangeset
for help on using the changeset viewer.