ext/: Take proper locks when handling events.
Original commit message from CVS: * ext/theora/theoradec.c: (theora_dec_src_query), (theora_dec_sink_event): * ext/theora/theoraenc.c: (theora_enc_sink_event), (theora_enc_change_state): * ext/vorbis/vorbisenc.c: (gst_vorbisenc_init), (gst_vorbisenc_sink_event), (gst_vorbisenc_change_state): Take proper locks when handling events.
This commit is contained in:
parent
2de274ea2c
commit
323ba80ff3
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2005-10-27 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* ext/theora/theoradec.c: (theora_dec_src_query),
|
||||||
|
(theora_dec_sink_event):
|
||||||
|
* ext/theora/theoraenc.c: (theora_enc_sink_event),
|
||||||
|
(theora_enc_change_state):
|
||||||
|
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_init),
|
||||||
|
(gst_vorbisenc_sink_event), (gst_vorbisenc_change_state):
|
||||||
|
Take proper locks when handling events.
|
||||||
|
|
||||||
2005-10-27 Wim Taymans <wim@fluendo.com>
|
2005-10-27 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/adder/gstadder.c: (gst_adder_query), (gst_adder_collected),
|
* gst/adder/gstadder.c: (gst_adder_query), (gst_adder_collected),
|
||||||
|
@ -419,20 +419,27 @@ theora_enc_sink_event (GstPad * pad, GstEvent * event)
|
|||||||
{
|
{
|
||||||
GstTheoraEnc *enc;
|
GstTheoraEnc *enc;
|
||||||
ogg_packet op;
|
ogg_packet op;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
enc = GST_THEORA_ENC (GST_PAD_PARENT (pad));
|
enc = GST_THEORA_ENC (GST_PAD_PARENT (pad));
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
|
GST_STREAM_LOCK (pad);
|
||||||
/* push last packet with eos flag */
|
/* push last packet with eos flag */
|
||||||
while (theora_encode_packetout (&enc->state, 1, &op)) {
|
while (theora_encode_packetout (&enc->state, 1, &op)) {
|
||||||
GstClockTime out_time =
|
GstClockTime out_time =
|
||||||
theora_granule_time (&enc->state, op.granulepos) * GST_SECOND;
|
theora_granule_time (&enc->state, op.granulepos) * GST_SECOND;
|
||||||
|
|
||||||
theora_push_packet (enc, &op, out_time, GST_SECOND / enc->fps);
|
theora_push_packet (enc, &op, out_time, GST_SECOND / enc->fps);
|
||||||
}
|
}
|
||||||
|
res = gst_pad_push_event (enc->srcpad, event);
|
||||||
|
GST_STREAM_UNLOCK (pad);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return gst_pad_event_default (pad, event);
|
res = gst_pad_push_event (enc->srcpad, event);
|
||||||
}
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
@ -721,11 +728,9 @@ theora_enc_change_state (GstElement * element, GstStateChange transition)
|
|||||||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
GST_STREAM_LOCK (enc->sinkpad);
|
|
||||||
theora_clear (&enc->state);
|
theora_clear (&enc->state);
|
||||||
theora_comment_clear (&enc->comment);
|
theora_comment_clear (&enc->comment);
|
||||||
theora_info_clear (&enc->info);
|
theora_info_clear (&enc->info);
|
||||||
GST_STREAM_UNLOCK (enc->sinkpad);
|
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
break;
|
break;
|
||||||
|
@ -550,8 +550,6 @@ gst_vorbisenc_init (GstVorbisEnc * vorbisenc)
|
|||||||
vorbisenc->quality_set = FALSE;
|
vorbisenc->quality_set = FALSE;
|
||||||
vorbisenc->last_message = NULL;
|
vorbisenc->last_message = NULL;
|
||||||
|
|
||||||
vorbisenc->setup = FALSE;
|
|
||||||
vorbisenc->header_sent = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -883,14 +881,17 @@ gst_vorbisenc_sink_event (GstPad * pad, GstEvent * event)
|
|||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
|
GST_STREAM_LOCK (pad);
|
||||||
/* Tell the library we're at end of stream so that it can handle
|
/* Tell the library we're at end of stream so that it can handle
|
||||||
* the last frame and mark end of stream in the output properly */
|
* the last frame and mark end of stream in the output properly */
|
||||||
GST_DEBUG_OBJECT (vorbisenc, "EOS, clearing state and sending event on");
|
GST_DEBUG_OBJECT (vorbisenc, "EOS, clearing state and sending event on");
|
||||||
gst_vorbisenc_clear (vorbisenc);
|
gst_vorbisenc_clear (vorbisenc);
|
||||||
|
|
||||||
res = gst_pad_event_default (pad, event);
|
res = gst_pad_push_event (vorbisenc->srcpad, event);
|
||||||
|
GST_STREAM_UNLOCK (pad);
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_TAG:
|
case GST_EVENT_TAG:
|
||||||
|
GST_STREAM_LOCK (pad);
|
||||||
if (vorbisenc->tags) {
|
if (vorbisenc->tags) {
|
||||||
GstTagList *list;
|
GstTagList *list;
|
||||||
|
|
||||||
@ -900,10 +901,11 @@ gst_vorbisenc_sink_event (GstPad * pad, GstEvent * event)
|
|||||||
} else {
|
} else {
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
}
|
}
|
||||||
res = gst_pad_event_default (pad, event);
|
res = gst_pad_push_event (vorbisenc->srcpad, event);
|
||||||
|
GST_STREAM_UNLOCK (pad);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
res = gst_pad_event_default (pad, event);
|
res = gst_pad_push_event (vorbisenc->srcpad, event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
@ -1141,7 +1143,11 @@ gst_vorbisenc_change_state (GstElement * element, GstStateChange transition)
|
|||||||
vorbisenc->tags = gst_tag_list_new ();
|
vorbisenc->tags = gst_tag_list_new ();
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
|
vorbisenc->setup = FALSE;
|
||||||
|
vorbisenc->header_sent = FALSE;
|
||||||
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1152,7 +1158,9 @@ gst_vorbisenc_change_state (GstElement * element, GstStateChange transition)
|
|||||||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
gst_vorbisenc_clear (vorbisenc);
|
vorbis_block_clear (&vorbisenc->vb);
|
||||||
|
vorbis_dsp_clear (&vorbisenc->vd);
|
||||||
|
vorbis_info_clear (&vorbisenc->vi);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
gst_tag_list_free (vorbisenc->tags);
|
gst_tag_list_free (vorbisenc->tags);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user