Changeset 139896 in webkit
- Timestamp:
- Jan 16, 2013, 10:44:18 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r139894 r139896 1 2013-01-16 Christophe Dumez <christophe.dumez@intel.com> 2 3 [gstreamer] Some media tests occasionally crash with gstreamer 1.0 backend 4 https://bugs.webkit.org/show_bug.cgi?id=106551 5 6 Reviewed by Philippe Normand. 7 8 ImageGStreamerCairo was passing mapped memory to 9 cairo_image_surface_create_for_data() and then unmapping it straight 10 away even though the cairo_surface_t is still used. The cairo 11 documentation states: 12 "The output buffer must be kept around until the cairo_surface_t is 13 destroyed or cairo_surface_finish() is called on the surface." 14 15 This patch keeps the GstBuffer memory mapped until the ImageGStreamer 16 is destroyed so that the internal cairo_surface_t stays valid while 17 avoiding copying the image data. 18 19 No new tests, already covered by existing tests. 20 21 * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: 22 (WTF::adoptGRef): 23 (WTF): 24 (WTF::GstBuffer): 25 * platform/graphics/gstreamer/GRefPtrGStreamer.h: 26 (WTF): Add support for using GRefPtr with GstBuffer. 27 * platform/graphics/gstreamer/ImageGStreamer.h: 28 (ImageGStreamer): 29 * platform/graphics/gstreamer/ImageGStreamerCairo.cpp: 30 (ImageGStreamer::ImageGStreamer): 31 (ImageGStreamer::~ImageGStreamer): 32 1 33 2013-01-16 Mike Reed <reed@google.com> 2 34 -
trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp
r132081 r139896 166 166 } 167 167 168 template<> GRefPtr<GstBuffer> adoptGRef(GstBuffer* ptr) 169 { 170 return GRefPtr<GstBuffer>(ptr, GRefPtrAdopt); 171 } 172 173 template<> GstBuffer* refGPtr<GstBuffer>(GstBuffer* ptr) 174 { 175 if (ptr) 176 gst_buffer_ref(ptr); 177 178 return ptr; 179 } 180 181 template<> void derefGPtr<GstBuffer>(GstBuffer* ptr) 182 { 183 if (ptr) 184 gst_buffer_unref(ptr); 185 } 168 186 } 169 187 #endif // USE(GSTREAMER) -
trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h
r131387 r139896 31 31 typedef struct _GstBus GstBus; 32 32 typedef struct _GstElementFactory GstElementFactory; 33 typedef struct _GstBuffer GstBuffer; 33 34 34 35 namespace WTF { … … 62 63 template<> void derefGPtr<GstElementFactory>(GstElementFactory* ptr); 63 64 65 template<> GRefPtr<GstBuffer> adoptGRef(GstBuffer* ptr); 66 template<> GstBuffer* refGPtr<GstBuffer>(GstBuffer* ptr); 67 template<> void derefGPtr<GstBuffer>(GstBuffer* ptr); 64 68 } 65 69 -
trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h
r130636 r139896 61 61 RefPtr<BitmapImage> m_image; 62 62 FloatRect m_cropRect; 63 64 #if USE(CAIRO) && defined(GST_API_VERSION_1) 65 GRefPtr<GstBuffer> m_buffer; 66 GstMapInfo m_mapInfo; 67 #endif 63 68 }; 64 69 } -
trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp
r120790 r139896 37 37 38 38 ImageGStreamer::ImageGStreamer(GstBuffer* buffer, GstCaps* caps) 39 #ifdef GST_API_VERSION_1 40 : m_buffer(buffer) 41 #endif 39 42 { 40 43 GstVideoFormat format; … … 44 47 45 48 #ifdef GST_API_VERSION_1 46 GstMapInfo mapInfo; 47 gst_buffer_map(buffer, &mapInfo, GST_MAP_READ); 48 unsigned char* bufferData = reinterpret_cast<unsigned char*>(mapInfo.data); 49 gst_buffer_map(buffer, &m_mapInfo, GST_MAP_READ); 50 unsigned char* bufferData = reinterpret_cast<unsigned char*>(m_mapInfo.data); 49 51 #else 50 52 unsigned char* bufferData = reinterpret_cast<unsigned char*>(GST_BUFFER_DATA(buffer)); … … 65 67 if (GstVideoCropMeta* cropMeta = gst_buffer_get_video_crop_meta(buffer)) 66 68 setCropRect(FloatRect(cropMeta->x, cropMeta->y, cropMeta->width, cropMeta->height)); 67 68 gst_buffer_unmap(buffer, &mapInfo);69 69 #endif 70 70 } … … 76 76 77 77 m_image = 0; 78 79 #ifdef GST_API_VERSION_1 80 // We keep the buffer memory mapped until the image is destroyed because the internal 81 // cairo_surface_t was created using cairo_image_surface_create_for_data(). 82 gst_buffer_unmap(m_buffer.get(), &m_mapInfo); 83 #endif 78 84 } 79 85 #endif // USE(GSTREAMER)
Note:
See TracChangeset
for help on using the changeset viewer.