summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-04-20 12:12:27 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-04-20 18:34:58 +0900
commit6458ca32bc80062e95337c5ebb36593723567a37 (patch)
treeb644c0b07995945a86cade5afd5ca98226b8dfb4 /src/modules
parent1804d460eeeb7cda9ec3ee82ebbd2ca6cfbf44cc (diff)
emotion - gst1 module - handle long standing bad map/unmap of gst buf
this fixes a pending XXX where we didnt keep the buffer mapped as long as the evas image object pointed to the video pixel data. this fixes this along with less over-zealous refinf to make things more obvious (now last_buffer actualyl really matters and if it was mapped and refed). @fix
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/emotion/gstreamer1/emotion_gstreamer.h2
-rw-r--r--src/modules/emotion/gstreamer1/emotion_sink.c46
2 files changed, 39 insertions, 9 deletions
diff --git a/src/modules/emotion/gstreamer1/emotion_gstreamer.h b/src/modules/emotion/gstreamer1/emotion_gstreamer.h
index 080ab77..dfee8e4 100644
--- a/src/modules/emotion/gstreamer1/emotion_gstreamer.h
+++ b/src/modules/emotion/gstreamer1/emotion_gstreamer.h
@@ -109,6 +109,7 @@ struct _EmotionVideoSinkPrivate {
109 109
110 /* We need to keep a copy of the last inserted buffer as evas doesn't copy YUV data around */ 110 /* We need to keep a copy of the last inserted buffer as evas doesn't copy YUV data around */
111 GstBuffer *last_buffer; 111 GstBuffer *last_buffer;
112 GstMapInfo map_info;
112 113
113 int frames; 114 int frames;
114 int flapse; 115 int flapse;
@@ -124,6 +125,7 @@ struct _EmotionVideoSinkPrivate {
124 // 125 //
125 // Protected by the buffer mutex 126 // Protected by the buffer mutex
126 Eina_Bool unlocked : 1; 127 Eina_Bool unlocked : 1;
128 Eina_Bool mapped : 1;
127}; 129};
128 130
129struct _Emotion_Gstreamer_Buffer 131struct _Emotion_Gstreamer_Buffer
diff --git a/src/modules/emotion/gstreamer1/emotion_sink.c b/src/modules/emotion/gstreamer1/emotion_sink.c
index 5e6f3be..6c410f8 100644
--- a/src/modules/emotion/gstreamer1/emotion_sink.c
+++ b/src/modules/emotion/gstreamer1/emotion_sink.c
@@ -137,6 +137,22 @@ emotion_video_sink_dispose(GObject* object)
137 sink = EMOTION_VIDEO_SINK(object); 137 sink = EMOTION_VIDEO_SINK(object);
138 priv = sink->priv; 138 priv = sink->priv;
139 139
140 if ((priv->mapped) && (priv->last_buffer))
141 {
142 if (priv->evas_object)
143 {
144 evas_object_image_size_set(priv->evas_object, 1, 1);
145 evas_object_image_data_set(priv->evas_object, NULL);
146 }
147 gst_buffer_unmap(priv->last_buffer, &(priv->map_info));
148 priv->mapped = EINA_FALSE;
149 }
150 if (priv->last_buffer)
151 {
152 if (priv->last_buffer) gst_buffer_unref(priv->last_buffer);
153 priv->last_buffer = NULL;
154 }
155
140 eina_lock_free(&priv->m); 156 eina_lock_free(&priv->m);
141 eina_condition_free(&priv->c); 157 eina_condition_free(&priv->c);
142 158
@@ -210,9 +226,21 @@ emotion_video_sink_stop(GstBaseSink* base_sink)
210 226
211 INF("sink stop"); 227 INF("sink stop");
212 228
213 gst_buffer_replace(&priv->last_buffer, NULL);
214
215 eina_lock_take(&priv->m); 229 eina_lock_take(&priv->m);
230 if (priv->last_buffer)
231 {
232 if (priv->evas_object)
233 {
234 evas_object_image_size_set(priv->evas_object, 1, 1);
235 evas_object_image_data_set(priv->evas_object, NULL);
236 }
237 if (priv->mapped)
238 gst_buffer_unmap(priv->last_buffer, &(priv->map_info));
239 priv->mapped = EINA_FALSE;
240 if (priv->last_buffer) gst_buffer_unref(priv->last_buffer);
241 priv->last_buffer = NULL;
242 }
243
216 /* If there still is a pending frame, neutralize it */ 244 /* If there still is a pending frame, neutralize it */
217 if (priv->send) 245 if (priv->send)
218 { 246 {
@@ -371,8 +399,6 @@ emotion_video_sink_main_render(void *data)
371 399
372 buffer = gst_buffer_ref(send->frame); 400 buffer = gst_buffer_ref(send->frame);
373 401
374 // XXX: need to map buffer and KEEP MAPPED until we set new video data or
375 // on the evas image object or release the object
376 if (!gst_buffer_map(buffer, &map, GST_MAP_READ)) 402 if (!gst_buffer_map(buffer, &map, GST_MAP_READ))
377 goto exit_point; 403 goto exit_point;
378 404
@@ -391,9 +417,6 @@ emotion_video_sink_main_render(void *data)
391 else 417 else
392 WRN("No way to decode %x colorspace !", send->eformat); 418 WRN("No way to decode %x colorspace !", send->eformat);
393 419
394 // XXX: this unmap here is broken
395 gst_buffer_unmap(buffer, &map);
396
397 evas_object_image_data_set(priv->evas_object, evas_data); 420 evas_object_image_data_set(priv->evas_object, evas_data);
398 evas_object_image_data_update_add(priv->evas_object, 0, 0, send->info.width, send->eheight); 421 evas_object_image_data_update_add(priv->evas_object, 0, 0, send->info.width, send->eheight);
399 evas_object_image_pixels_dirty_set(priv->evas_object, 0); 422 evas_object_image_pixels_dirty_set(priv->evas_object, 0);
@@ -405,7 +428,13 @@ emotion_video_sink_main_render(void *data)
405 428
406 _emotion_frame_resize(priv->emotion_object, send->info.width, send->eheight, ratio); 429 _emotion_frame_resize(priv->emotion_object, send->info.width, send->eheight, ratio);
407 430
408 gst_buffer_replace(&priv->last_buffer, buffer); 431 if ((priv->mapped) && (priv->last_buffer))
432 gst_buffer_unmap(priv->last_buffer, &(priv->map_info));
433 priv->map_info = map;
434 priv->mapped = EINA_TRUE;
435
436 if (priv->last_buffer) gst_buffer_unref(priv->last_buffer);
437 priv->last_buffer = buffer;
409 438
410 _emotion_frame_new(priv->emotion_object); 439 _emotion_frame_new(priv->emotion_object);
411 440
@@ -415,7 +444,6 @@ emotion_video_sink_main_render(void *data)
415 444
416 eina_lock_release(&priv->m); 445 eina_lock_release(&priv->m);
417 446
418 if (buffer) gst_buffer_unref(buffer);
419 emotion_gstreamer_buffer_free(send); 447 emotion_gstreamer_buffer_free(send);
420 448
421 _emotion_pending_ecore_end(); 449 _emotion_pending_ecore_end();