• Home
  • Raw
  • Download

Lines Matching refs:demux

264 gst_adaptive_demux_push_src_event (GstAdaptiveDemux * demux, GstEvent * event);
266 static void gst_adaptive_demux_updates_loop (GstAdaptiveDemux * demux);
269 static void gst_adaptive_demux_reset (GstAdaptiveDemux * demux);
270 static gboolean gst_adaptive_demux_prepare_streams (GstAdaptiveDemux * demux,
272 static gboolean gst_adaptive_demux_expose_streams (GstAdaptiveDemux * demux);
273 static gboolean gst_adaptive_demux_is_live (GstAdaptiveDemux * demux);
274 static GstFlowReturn gst_adaptive_demux_stream_seek (GstAdaptiveDemux * demux,
278 demux, GstAdaptiveDemuxStream * stream);
280 demux, GstAdaptiveDemuxStream * stream, guint64 bitrate);
282 gst_adaptive_demux_stream_update_fragment_info (GstAdaptiveDemux * demux,
285 gst_adaptive_demux_stream_get_fragment_waiting_time (GstAdaptiveDemux * demux,
288 demux);
290 gst_adaptive_demux_update_manifest_default (GstAdaptiveDemux * demux);
291 static gboolean gst_adaptive_demux_has_next_period (GstAdaptiveDemux * demux);
292 static void gst_adaptive_demux_advance_period (GstAdaptiveDemux * demux);
300 demux);
302 demux);
304 static void gst_adaptive_demux_start_tasks (GstAdaptiveDemux * demux,
306 static void gst_adaptive_demux_stop_tasks (GstAdaptiveDemux * demux,
309 demux);
314 gst_adaptive_demux_stream_data_received_default (GstAdaptiveDemux * demux,
317 gst_adaptive_demux_stream_finish_fragment_default (GstAdaptiveDemux * demux,
320 gst_adaptive_demux_stream_advance_fragment_unlocked (GstAdaptiveDemux * demux,
329 * demux);
335 static void set_property_to_src_and_download (GstAdaptiveDemux *demux, guint property_id, const voi…
379 gst_adaptive_demux_set_exit_block (GstAdaptiveDemux *demux, const GValue *value) in gst_adaptive_demux_set_exit_block() argument
383 if (demux->priv == NULL) { in gst_adaptive_demux_set_exit_block()
384 GST_WARNING_OBJECT (demux, "adaptive exit_block :%d, demux->priv is null", exit_block); in gst_adaptive_demux_set_exit_block()
392 if (demux->priv->updates_task != NULL) { in gst_adaptive_demux_set_exit_block()
393 gst_task_stop (demux->priv->updates_task); in gst_adaptive_demux_set_exit_block()
394 demux->priv->updates_task = NULL; in gst_adaptive_demux_set_exit_block()
396 g_mutex_lock (&demux->priv->updates_timed_lock); in gst_adaptive_demux_set_exit_block()
397 demux->priv->stop_updates_task = TRUE; in gst_adaptive_demux_set_exit_block()
398 g_cond_signal (&demux->priv->updates_timed_cond); in gst_adaptive_demux_set_exit_block()
399 g_mutex_unlock (&demux->priv->updates_timed_lock); in gst_adaptive_demux_set_exit_block()
400 if (demux->downloader != NULL) { in gst_adaptive_demux_set_exit_block()
401 gst_uri_downloader_cancel (demux->downloader); in gst_adaptive_demux_set_exit_block()
404 for (iter = demux->streams; iter != NULL; iter = g_list_next (iter)) { in gst_adaptive_demux_set_exit_block()
407 GST_WARNING_OBJECT (demux, "stream is null"); in gst_adaptive_demux_set_exit_block()
420 set_property_to_src_and_download (demux, PROP_EXIT_BLOCK, (void *) &exit_block); in gst_adaptive_demux_set_exit_block()
428 GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX (object); in gst_adaptive_demux_set_property() local
434 GST_API_LOCK (demux); in gst_adaptive_demux_set_property()
435 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_set_property()
445 demux->connection_speed = g_value_get_uint (value); in gst_adaptive_demux_set_property()
447 demux->connection_speed = g_value_get_uint (value) * 1000; in gst_adaptive_demux_set_property()
449 GST_DEBUG_OBJECT (demux, "Connection speed set to %u", in gst_adaptive_demux_set_property()
450 demux->connection_speed); in gst_adaptive_demux_set_property()
453 demux->bitrate_limit = g_value_get_float (value); in gst_adaptive_demux_set_property()
459 set_property_to_src_and_download(demux, prop_id, (void *)&timeout); in gst_adaptive_demux_set_property()
464 set_property_to_src_and_download(demux, prop_id, (void *)&state); in gst_adaptive_demux_set_property()
469 gst_adaptive_demux_set_exit_block(demux, value); in gst_adaptive_demux_set_property()
482 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_set_property()
483 GST_API_UNLOCK (demux); in gst_adaptive_demux_set_property()
494 GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX (object); in gst_adaptive_demux_get_property() local
496 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_get_property()
500 g_value_set_uint (value, demux->connection_speed / 1000); in gst_adaptive_demux_get_property()
503 g_value_set_float (value, demux->bitrate_limit); in gst_adaptive_demux_get_property()
510 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_get_property()
598 gst_adaptive_demux_init (GstAdaptiveDemux * demux, in gst_adaptive_demux_init() argument
605 GST_DEBUG_OBJECT (demux, "gst_adaptive_demux_init"); in gst_adaptive_demux_init()
607 demux->priv = gst_adaptive_demux_get_instance_private (demux); in gst_adaptive_demux_init()
608 demux->priv->input_adapter = gst_adapter_new (); in gst_adaptive_demux_init()
609 demux->downloader = gst_uri_downloader_new (); in gst_adaptive_demux_init()
610 gst_uri_downloader_set_parent (demux->downloader, GST_ELEMENT_CAST (demux)); in gst_adaptive_demux_init()
611 demux->stream_struct_size = sizeof (GstAdaptiveDemuxStream); in gst_adaptive_demux_init()
612 demux->priv->segment_seqnum = gst_util_seqnum_next (); in gst_adaptive_demux_init()
613 demux->have_group_id = FALSE; in gst_adaptive_demux_init()
614 demux->group_id = G_MAXUINT; in gst_adaptive_demux_init()
616 gst_segment_init (&demux->segment, GST_FORMAT_TIME); in gst_adaptive_demux_init()
618 gst_bin_set_suppressed_flags (GST_BIN_CAST (demux), in gst_adaptive_demux_init()
621 demux->realtime_clock = gst_system_clock_obtain (); in gst_adaptive_demux_init()
622 g_assert (demux->realtime_clock != NULL); in gst_adaptive_demux_init()
623 gobject_class = G_OBJECT_GET_CLASS (demux->realtime_clock); in gst_adaptive_demux_init()
625 g_object_get (demux->realtime_clock, "clock-type", &clock_type, NULL); in gst_adaptive_demux_init()
627 GST_WARNING_OBJECT (demux, in gst_adaptive_demux_init()
631 demux->clock_offset = 0; in gst_adaptive_demux_init()
637 rtc_now = gst_clock_get_time (demux->realtime_clock); in gst_adaptive_demux_init()
638 demux->clock_offset = in gst_adaptive_demux_init()
643 g_rec_mutex_init (&demux->priv->updates_lock); in gst_adaptive_demux_init()
644 demux->priv->updates_task = in gst_adaptive_demux_init()
646 demux, NULL); in gst_adaptive_demux_init()
647 gst_task_set_lock (demux->priv->updates_task, &demux->priv->updates_lock); in gst_adaptive_demux_init()
649 g_mutex_init (&demux->priv->updates_timed_lock); in gst_adaptive_demux_init()
650 g_cond_init (&demux->priv->updates_timed_cond); in gst_adaptive_demux_init()
652 g_cond_init (&demux->priv->manifest_cond); in gst_adaptive_demux_init()
653 g_mutex_init (&demux->priv->manifest_update_lock); in gst_adaptive_demux_init()
655 g_rec_mutex_init (&demux->priv->manifest_lock); in gst_adaptive_demux_init()
656 g_mutex_init (&demux->priv->api_lock); in gst_adaptive_demux_init()
657 g_mutex_init (&demux->priv->segment_lock); in gst_adaptive_demux_init()
659 g_cond_init (&demux->priv->preroll_cond); in gst_adaptive_demux_init()
660 g_mutex_init (&demux->priv->preroll_lock); in gst_adaptive_demux_init()
666 demux->sinkpad = gst_pad_new_from_template (pad_template, "sink"); in gst_adaptive_demux_init()
667 gst_pad_set_event_function (demux->sinkpad, in gst_adaptive_demux_init()
669 gst_pad_set_chain_function (demux->sinkpad, in gst_adaptive_demux_init()
673 demux->bitrate_limit = DEFAULT_BITRATE_LIMIT; in gst_adaptive_demux_init()
674 demux->connection_speed = DEFAULT_CONNECTION_SPEED; in gst_adaptive_demux_init()
676 gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad); in gst_adaptive_demux_init()
682 GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (object); in gst_adaptive_demux_finalize() local
683 GstAdaptiveDemuxPrivate *priv = demux->priv; in gst_adaptive_demux_finalize()
688 g_object_unref (demux->downloader); in gst_adaptive_demux_finalize()
692 g_mutex_clear (&demux->priv->manifest_update_lock); in gst_adaptive_demux_finalize()
693 g_cond_clear (&demux->priv->manifest_cond); in gst_adaptive_demux_finalize()
696 g_rec_mutex_clear (&demux->priv->manifest_lock); in gst_adaptive_demux_finalize()
697 g_mutex_clear (&demux->priv->api_lock); in gst_adaptive_demux_finalize()
698 g_mutex_clear (&demux->priv->segment_lock); in gst_adaptive_demux_finalize()
699 if (demux->realtime_clock) { in gst_adaptive_demux_finalize()
700 gst_object_unref (demux->realtime_clock); in gst_adaptive_demux_finalize()
701 demux->realtime_clock = NULL; in gst_adaptive_demux_finalize()
704 g_cond_clear (&demux->priv->preroll_cond); in gst_adaptive_demux_finalize()
705 g_mutex_clear (&demux->priv->preroll_lock); in gst_adaptive_demux_finalize()
769 set_property_to_src_and_download (GstAdaptiveDemux *demux, guint property_id, const void *property_… in set_property_to_src_and_download() argument
771 if ((demux == NULL) || (property_value == NULL)) { in set_property_to_src_and_download()
776 set_property_to_src_element (demux->streams, property_id, property_value); in set_property_to_src_and_download()
785 GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (element); in gst_adaptive_demux_change_state() local
790 if (g_atomic_int_compare_and_exchange (&demux->running, TRUE, FALSE)) in gst_adaptive_demux_change_state()
791 GST_DEBUG_OBJECT (demux, "demuxer has stopped running"); in gst_adaptive_demux_change_state()
792 gst_uri_downloader_cancel (demux->downloader); in gst_adaptive_demux_change_state()
794 GST_API_LOCK (demux); in gst_adaptive_demux_change_state()
795 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_change_state()
796 gst_adaptive_demux_reset (demux); in gst_adaptive_demux_change_state()
797 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_change_state()
798 GST_API_UNLOCK (demux); in gst_adaptive_demux_change_state()
801 GST_API_LOCK (demux); in gst_adaptive_demux_change_state()
802 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_change_state()
803 gst_adaptive_demux_reset (demux); in gst_adaptive_demux_change_state()
806 gst_uri_downloader_reset (demux->downloader); in gst_adaptive_demux_change_state()
807 if (g_atomic_int_get (&demux->priv->have_manifest)) in gst_adaptive_demux_change_state()
808 gst_adaptive_demux_start_manifest_update_task (demux); in gst_adaptive_demux_change_state()
809 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_change_state()
810 GST_API_UNLOCK (demux); in gst_adaptive_demux_change_state()
811 if (g_atomic_int_compare_and_exchange (&demux->running, FALSE, TRUE)) in gst_adaptive_demux_change_state()
812 GST_DEBUG_OBJECT (demux, "demuxer has started running"); in gst_adaptive_demux_change_state()
831 gst_adaptive_demux_update_bitrate (GstAdaptiveDemux *demux) in gst_adaptive_demux_update_bitrate() argument
836 GstAdaptiveDemuxClass *demux_class = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_update_bitrate()
841 gboolean ret = demux_class->get_bitrate_info(demux, &stream_bitrate_info); in gst_adaptive_demux_update_bitrate()
846 GST_INFO_OBJECT (demux, "Send to user, bitrate num = %u", stream_bitrate_info.bitrate_num); in gst_adaptive_demux_update_bitrate()
847 g_signal_emit (GST_ELEMENT(demux), g_gst_adaptive_demux_signals[SIGNAL_BITRATE_PARSE_COMPLETE], in gst_adaptive_demux_update_bitrate()
862 GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (parent); in gst_adaptive_demux_sink_event() local
867 GST_API_LOCK (demux); in gst_adaptive_demux_sink_event()
868 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_sink_event()
870 gst_adaptive_demux_reset (demux); in gst_adaptive_demux_sink_event()
874 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_sink_event()
875 GST_API_UNLOCK (demux); in gst_adaptive_demux_sink_event()
887 GST_API_LOCK (demux); in gst_adaptive_demux_sink_event()
888 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_sink_event()
890 demux_class = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_sink_event()
892 available = gst_adapter_available (demux->priv->input_adapter); in gst_adaptive_demux_sink_event()
895 GST_WARNING_OBJECT (demux, "Received EOS without a manifest."); in gst_adaptive_demux_sink_event()
898 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_sink_event()
899 GST_API_UNLOCK (demux); in gst_adaptive_demux_sink_event()
904 GST_DEBUG_OBJECT (demux, "Got EOS on the sink pad: manifest fetched"); in gst_adaptive_demux_sink_event()
919 demux->manifest_uri = redirect_uri; in gst_adaptive_demux_sink_event()
920 demux->manifest_base_uri = NULL; in gst_adaptive_demux_sink_event()
923 demux->manifest_uri = uri; in gst_adaptive_demux_sink_event()
924 demux->manifest_base_uri = redirect_uri; in gst_adaptive_demux_sink_event()
927 GST_DEBUG_OBJECT (demux, "Fetched manifest at URI: %s (base: %s)", in gst_adaptive_demux_sink_event()
928 demux->manifest_uri, GST_STR_NULL (demux->manifest_base_uri)); in gst_adaptive_demux_sink_event()
930 GST_WARNING_OBJECT (demux, "Upstream URI query failed."); in gst_adaptive_demux_sink_event()
936 gst_adapter_take_buffer (demux->priv->input_adapter, available); in gst_adaptive_demux_sink_event()
937 if (!demux_class->process_manifest (demux, manifest_buffer)) { in gst_adaptive_demux_sink_event()
941 GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Invalid manifest."), in gst_adaptive_demux_sink_event()
945 g_atomic_int_set (&demux->priv->have_manifest, TRUE); in gst_adaptive_demux_sink_event()
951 gst_adaptive_demux_update_bitrate(demux); in gst_adaptive_demux_sink_event()
956 gst_element_post_message (GST_ELEMENT_CAST (demux), in gst_adaptive_demux_sink_event()
957 gst_message_new_element (GST_OBJECT_CAST (demux), in gst_adaptive_demux_sink_event()
960 demux->manifest_uri, "uri", G_TYPE_STRING, in gst_adaptive_demux_sink_event()
961 demux->manifest_uri, in gst_adaptive_demux_sink_event()
969 if (!gst_adaptive_demux_is_live (demux)) { in gst_adaptive_demux_sink_event()
970 GstClockTime duration = demux_class->get_duration (demux); in gst_adaptive_demux_sink_event()
973 GST_DEBUG_OBJECT (demux, in gst_adaptive_demux_sink_event()
976 gst_element_post_message (GST_ELEMENT (demux), in gst_adaptive_demux_sink_event()
977 gst_message_new_duration_changed (GST_OBJECT (demux))); in gst_adaptive_demux_sink_event()
979 GST_DEBUG_OBJECT (demux, in gst_adaptive_demux_sink_event()
984 if (demux->next_streams) { in gst_adaptive_demux_sink_event()
985 gst_adaptive_demux_prepare_streams (demux, in gst_adaptive_demux_sink_event()
986 gst_adaptive_demux_is_live (demux)); in gst_adaptive_demux_sink_event()
987 gst_adaptive_demux_start_tasks (demux, TRUE); in gst_adaptive_demux_sink_event()
988 gst_adaptive_demux_start_manifest_update_task (demux); in gst_adaptive_demux_sink_event()
991 GST_WARNING_OBJECT (demux, "No streams created from manifest"); in gst_adaptive_demux_sink_event()
992 GST_ELEMENT_ERROR (demux, STREAM, DEMUX, in gst_adaptive_demux_sink_event()
999 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_sink_event()
1000 GST_API_UNLOCK (demux); in gst_adaptive_demux_sink_event()
1020 GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (parent); in gst_adaptive_demux_sink_chain() local
1022 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_sink_chain()
1024 gst_adapter_push (demux->priv->input_adapter, buffer); in gst_adaptive_demux_sink_chain()
1026 GST_INFO_OBJECT (demux, "Received manifest buffer, total size is %i bytes", in gst_adaptive_demux_sink_chain()
1027 (gint) gst_adapter_available (demux->priv->input_adapter)); in gst_adaptive_demux_sink_chain()
1029 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_sink_chain()
1035 gst_adaptive_demux_reset (GstAdaptiveDemux * demux) in gst_adaptive_demux_reset() argument
1037 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_reset()
1045 old_streams = demux->priv->old_streams; in gst_adaptive_demux_reset()
1046 demux->priv->old_streams = NULL; in gst_adaptive_demux_reset()
1048 gst_adaptive_demux_stop_tasks (demux, TRUE); in gst_adaptive_demux_reset()
1051 klass->reset (demux); in gst_adaptive_demux_reset()
1054 for (iter = demux->streams; iter; iter = g_list_next (iter)) { in gst_adaptive_demux_reset()
1060 gst_element_remove_pad (GST_ELEMENT_CAST (demux), stream->pad); in gst_adaptive_demux_reset()
1065 g_list_free (demux->streams); in gst_adaptive_demux_reset()
1066 demux->streams = NULL; in gst_adaptive_demux_reset()
1067 if (demux->prepared_streams) { in gst_adaptive_demux_reset()
1068 g_list_free_full (demux->prepared_streams, in gst_adaptive_demux_reset()
1070 demux->prepared_streams = NULL; in gst_adaptive_demux_reset()
1072 if (demux->next_streams) { in gst_adaptive_demux_reset()
1073 g_list_free_full (demux->next_streams, in gst_adaptive_demux_reset()
1075 demux->next_streams = NULL; in gst_adaptive_demux_reset()
1083 if (demux->priv->old_streams) { in gst_adaptive_demux_reset()
1084 g_list_free_full (demux->priv->old_streams, in gst_adaptive_demux_reset()
1086 demux->priv->old_streams = NULL; in gst_adaptive_demux_reset()
1089 g_free (demux->manifest_uri); in gst_adaptive_demux_reset()
1090 g_free (demux->manifest_base_uri); in gst_adaptive_demux_reset()
1091 demux->manifest_uri = NULL; in gst_adaptive_demux_reset()
1092 demux->manifest_base_uri = NULL; in gst_adaptive_demux_reset()
1094 gst_adapter_clear (demux->priv->input_adapter); in gst_adaptive_demux_reset()
1095 g_atomic_int_set (&demux->priv->have_manifest, FALSE); in gst_adaptive_demux_reset()
1097 gst_segment_init (&demux->segment, GST_FORMAT_TIME); in gst_adaptive_demux_reset()
1099 demux->have_group_id = FALSE; in gst_adaptive_demux_reset()
1100 demux->group_id = G_MAXUINT; in gst_adaptive_demux_reset()
1101 demux->priv->segment_seqnum = gst_util_seqnum_next (); in gst_adaptive_demux_reset()
1107 GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (bin); in gst_adaptive_demux_handle_message() local
1118 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_handle_message()
1120 for (iter = demux->streams; iter; iter = g_list_next (iter)) { in gst_adaptive_demux_handle_message()
1129 for (iter = demux->prepared_streams; iter; iter = g_list_next (iter)) { in gst_adaptive_demux_handle_message()
1138 GST_WARNING_OBJECT (demux, in gst_adaptive_demux_handle_message()
1170 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_handle_message()
1185 gst_adaptive_demux_set_stream_struct_size (GstAdaptiveDemux * demux, in gst_adaptive_demux_set_stream_struct_size() argument
1188 GST_API_LOCK (demux); in gst_adaptive_demux_set_stream_struct_size()
1189 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_set_stream_struct_size()
1190 demux->stream_struct_size = struct_size; in gst_adaptive_demux_set_stream_struct_size()
1191 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_set_stream_struct_size()
1192 GST_API_UNLOCK (demux); in gst_adaptive_demux_set_stream_struct_size()
1197 gst_adaptive_demux_prepare_stream (GstAdaptiveDemux * demux, in gst_adaptive_demux_prepare_stream() argument
1208 stream_id = gst_pad_create_stream_id (pad, GST_ELEMENT_CAST (demux), name); in gst_adaptive_demux_prepare_stream()
1211 gst_pad_get_sticky_event (GST_ADAPTIVE_DEMUX_SINK_PAD (demux), in gst_adaptive_demux_prepare_stream()
1214 if (gst_event_parse_group_id (event, &demux->group_id)) in gst_adaptive_demux_prepare_stream()
1215 demux->have_group_id = TRUE; in gst_adaptive_demux_prepare_stream()
1217 demux->have_group_id = FALSE; in gst_adaptive_demux_prepare_stream()
1219 } else if (!demux->have_group_id) { in gst_adaptive_demux_prepare_stream()
1220 demux->have_group_id = TRUE; in gst_adaptive_demux_prepare_stream()
1221 demux->group_id = gst_util_group_id_next (); in gst_adaptive_demux_prepare_stream()
1224 if (demux->have_group_id) in gst_adaptive_demux_prepare_stream()
1225 gst_event_set_group_id (event, demux->group_id); in gst_adaptive_demux_prepare_stream()
1231 GST_DEBUG_OBJECT (demux, "Preparing srcpad %s:%s", GST_DEBUG_PAD_NAME (pad)); in gst_adaptive_demux_prepare_stream()
1239 gst_adaptive_demux_expose_stream (GstAdaptiveDemux * demux, in gst_adaptive_demux_expose_stream() argument
1254 GST_DEBUG_OBJECT (demux, "Exposing srcpad %s:%s with caps %" GST_PTR_FORMAT, in gst_adaptive_demux_expose_stream()
1262 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_expose_stream()
1263 ret = gst_element_add_pad (GST_ELEMENT_CAST (demux), pad); in gst_adaptive_demux_expose_stream()
1264 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_expose_stream()
1271 gst_adaptive_demux_stream_get_presentation_offset (GstAdaptiveDemux * demux, in gst_adaptive_demux_stream_get_presentation_offset() argument
1276 klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_stream_get_presentation_offset()
1281 return klass->get_presentation_offset (demux, stream); in gst_adaptive_demux_stream_get_presentation_offset()
1286 gst_adaptive_demux_get_period_start_time (GstAdaptiveDemux * demux) in gst_adaptive_demux_get_period_start_time() argument
1290 klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_get_period_start_time()
1295 return klass->get_period_start_time (demux); in gst_adaptive_demux_get_period_start_time()
1300 gst_adaptive_demux_prepare_streams (GstAdaptiveDemux * demux, in gst_adaptive_demux_prepare_streams() argument
1306 g_return_val_if_fail (demux->next_streams != NULL, FALSE); in gst_adaptive_demux_prepare_streams()
1307 if (demux->prepared_streams != NULL) { in gst_adaptive_demux_prepare_streams()
1309 GST_FIXME_OBJECT (demux, in gst_adaptive_demux_prepare_streams()
1314 demux->prepared_streams = demux->next_streams; in gst_adaptive_demux_prepare_streams()
1315 demux->next_streams = NULL; in gst_adaptive_demux_prepare_streams()
1317 if (!gst_adaptive_demux_is_running (demux)) { in gst_adaptive_demux_prepare_streams()
1318 GST_DEBUG_OBJECT (demux, "Not exposing pads due to shutdown"); in gst_adaptive_demux_prepare_streams()
1322 for (iter = demux->prepared_streams; iter; iter = g_list_next (iter)) { in gst_adaptive_demux_prepare_streams()
1327 if (!gst_adaptive_demux_prepare_stream (demux, in gst_adaptive_demux_prepare_streams()
1337 GST_DEBUG_OBJECT (demux, "Calling update_fragment_info"); in gst_adaptive_demux_prepare_streams()
1338 gst_adaptive_demux_stream_update_fragment_info (demux, stream); in gst_adaptive_demux_prepare_streams()
1348 period_start = gst_adaptive_demux_get_period_start_time (demux); in gst_adaptive_demux_prepare_streams()
1357 gst_segment_do_seek (&demux->segment, demux->segment.rate, GST_FORMAT_TIME, in gst_adaptive_demux_prepare_streams()
1362 for (iter = demux->prepared_streams; iter; iter = g_list_next (iter)) { in gst_adaptive_demux_prepare_streams()
1366 offset = gst_adaptive_demux_stream_get_presentation_offset (demux, stream); in gst_adaptive_demux_prepare_streams()
1367 stream->segment = demux->segment; in gst_adaptive_demux_prepare_streams()
1424 GST_DEBUG_OBJECT (demux, "Using demux segment %" GST_SEGMENT_FORMAT, in gst_adaptive_demux_prepare_streams()
1425 &demux->segment); in gst_adaptive_demux_prepare_streams()
1426 GST_DEBUG_OBJECT (demux, in gst_adaptive_demux_prepare_streams()
1434 stream->segment.start = demux->segment.start - period_start + offset; in gst_adaptive_demux_prepare_streams()
1435 if (GST_CLOCK_TIME_IS_VALID (demux->segment.stop)) in gst_adaptive_demux_prepare_streams()
1436 stream->segment.stop = demux->segment.stop - period_start + offset; in gst_adaptive_demux_prepare_streams()
1439 } else if (demux->segment.start > period_start) { in gst_adaptive_demux_prepare_streams()
1441 stream->segment.start = demux->segment.start - period_start + offset; in gst_adaptive_demux_prepare_streams()
1442 if (GST_CLOCK_TIME_IS_VALID (demux->segment.stop)) in gst_adaptive_demux_prepare_streams()
1443 stream->segment.stop = demux->segment.stop - period_start + offset; in gst_adaptive_demux_prepare_streams()
1450 if (GST_CLOCK_TIME_IS_VALID (demux->segment.stop)) in gst_adaptive_demux_prepare_streams()
1451 stream->segment.stop = demux->segment.stop - period_start + offset; in gst_adaptive_demux_prepare_streams()
1457 gst_segment_to_stream_time (&demux->segment, GST_FORMAT_TIME, in gst_adaptive_demux_prepare_streams()
1460 gst_segment_to_running_time (&demux->segment, GST_FORMAT_TIME, in gst_adaptive_demux_prepare_streams()
1465 gst_event_set_seqnum (stream->pending_segment, demux->priv->segment_seqnum); in gst_adaptive_demux_prepare_streams()
1467 GST_DEBUG_OBJECT (demux, in gst_adaptive_demux_prepare_streams()
1471 demux->priv->qos_earliest_time = GST_CLOCK_TIME_NONE; in gst_adaptive_demux_prepare_streams()
1477 gst_adaptive_demux_expose_streams (GstAdaptiveDemux * demux) in gst_adaptive_demux_expose_streams() argument
1482 g_return_val_if_fail (demux->prepared_streams != NULL, FALSE); in gst_adaptive_demux_expose_streams()
1484 old_streams = demux->streams; in gst_adaptive_demux_expose_streams()
1485 demux->streams = demux->prepared_streams; in gst_adaptive_demux_expose_streams()
1486 demux->prepared_streams = NULL; in gst_adaptive_demux_expose_streams()
1488 for (iter = demux->streams; iter; iter = g_list_next (iter)) { in gst_adaptive_demux_expose_streams()
1491 if (!gst_adaptive_demux_expose_stream (demux, in gst_adaptive_demux_expose_streams()
1496 demux->priv->preroll_pending = 0; in gst_adaptive_demux_expose_streams()
1498 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_expose_streams()
1499 gst_element_no_more_pads (GST_ELEMENT_CAST (demux)); in gst_adaptive_demux_expose_streams()
1500 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_expose_streams()
1513 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_expose_streams()
1520 gst_element_remove_pad (GST_ELEMENT (demux), pad); in gst_adaptive_demux_expose_streams()
1521 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_expose_streams()
1550 demux->priv->old_streams = in gst_adaptive_demux_expose_streams()
1551 g_list_concat (demux->priv->old_streams, old_streams); in gst_adaptive_demux_expose_streams()
1555 for (iter = demux->streams; iter; iter = g_list_next (iter)) { in gst_adaptive_demux_expose_streams()
1560 GST_DEBUG_OBJECT (demux, "All streams are exposed"); in gst_adaptive_demux_expose_streams()
1567 gst_adaptive_demux_stream_new (GstAdaptiveDemux * demux, GstPad * pad) in gst_adaptive_demux_stream_new() argument
1571 stream = g_malloc0 (demux->stream_struct_size); in gst_adaptive_demux_stream_new()
1581 stream->demux = demux; in gst_adaptive_demux_stream_new()
1587 g_mutex_lock (&demux->priv->preroll_lock); in gst_adaptive_demux_stream_new()
1589 demux->priv->preroll_pending++; in gst_adaptive_demux_stream_new()
1590 g_mutex_unlock (&demux->priv->preroll_lock); in gst_adaptive_demux_stream_new()
1601 demux->next_streams = g_list_append (demux->next_streams, stream); in gst_adaptive_demux_stream_new()
1607 gst_adaptive_demux_find_stream_for_pad (GstAdaptiveDemux * demux, GstPad * pad) in gst_adaptive_demux_find_stream_for_pad() argument
1611 for (iter = demux->streams; iter; iter = g_list_next (iter)) { in gst_adaptive_demux_find_stream_for_pad()
1630 GstAdaptiveDemux *demux = stream->demux; in gst_adaptive_demux_stream_free() local
1631 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_stream_free()
1639 GST_DEBUG_OBJECT (demux, "Leaving streaming task %s:%s", in gst_adaptive_demux_stream_free()
1649 GST_LOG_OBJECT (demux, "Waiting for task to finish"); in gst_adaptive_demux_stream_free()
1652 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_free()
1656 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_free()
1658 GST_LOG_OBJECT (demux, "Finished"); in gst_adaptive_demux_stream_free()
1690 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_free()
1693 gst_bin_remove (GST_BIN_CAST (demux), src); in gst_adaptive_demux_stream_free()
1694 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_free()
1715 gst_adaptive_demux_get_live_seek_range (GstAdaptiveDemux * demux, in gst_adaptive_demux_get_live_seek_range() argument
1720 klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_get_live_seek_range()
1724 return klass->get_live_seek_range (demux, range_start, range_stop); in gst_adaptive_demux_get_live_seek_range()
1729 gst_adaptive_demux_stream_in_live_seek_range (GstAdaptiveDemux * demux, in gst_adaptive_demux_stream_in_live_seek_range() argument
1733 if (gst_adaptive_demux_get_live_seek_range (demux, &range_start, &range_stop)) { in gst_adaptive_demux_stream_in_live_seek_range()
1748 gst_adaptive_demux_can_seek (GstAdaptiveDemux * demux) in gst_adaptive_demux_can_seek() argument
1752 klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_can_seek()
1753 if (gst_adaptive_demux_is_live (demux)) { in gst_adaptive_demux_can_seek()
1761 gst_adaptive_demux_update_streams_segment (GstAdaptiveDemux * demux, in gst_adaptive_demux_update_streams_segment() argument
1773 stream->segment = demux->segment; in gst_adaptive_demux_update_streams_segment()
1774 offset = gst_adaptive_demux_stream_get_presentation_offset (demux, stream); in gst_adaptive_demux_update_streams_segment()
1776 if (GST_CLOCK_TIME_IS_VALID (demux->segment.stop)) in gst_adaptive_demux_update_streams_segment()
1778 if (demux->segment.rate > 0 && start_type != GST_SEEK_TYPE_NONE) in gst_adaptive_demux_update_streams_segment()
1780 else if (demux->segment.rate < 0 && stop_type != GST_SEEK_TYPE_NONE) in gst_adaptive_demux_update_streams_segment()
1783 gst_event_set_seqnum (seg_evt, demux->priv->segment_seqnum); in gst_adaptive_demux_update_streams_segment()
1791 demux->priv->qos_earliest_time = GST_CLOCK_TIME_NONE; in gst_adaptive_demux_update_streams_segment()
1804 gst_adaptive_demux_handle_seek_event (GstAdaptiveDemux * demux, GstPad * pad, in gst_adaptive_demux_handle_seek_event() argument
1807 GstAdaptiveDemuxClass *demux_class = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_handle_seek_event()
1819 GST_INFO_OBJECT (demux, "Received seek event"); in gst_adaptive_demux_handle_seek_event()
1821 GST_API_LOCK (demux); in gst_adaptive_demux_handle_seek_event()
1822 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_handle_seek_event()
1828 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1829 GST_API_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1830 GST_WARNING_OBJECT (demux, in gst_adaptive_demux_handle_seek_event()
1837 GST_FIXME_OBJECT (demux, "Handle segment seeks"); in gst_adaptive_demux_handle_seek_event()
1838 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1839 GST_API_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1855 if ((demux->segment.rate > 0 && rate < 0) || in gst_adaptive_demux_handle_seek_event()
1856 (demux->segment.rate < 0 && rate > 0) || in gst_adaptive_demux_handle_seek_event()
1859 GST_ERROR_OBJECT (demux, in gst_adaptive_demux_handle_seek_event()
1862 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1863 GST_API_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1867 ev = gst_event_new_instant_rate_change (rate / demux->segment.rate, in gst_adaptive_demux_handle_seek_event()
1871 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1873 ret = gst_adaptive_demux_push_src_event (demux, ev); in gst_adaptive_demux_handle_seek_event()
1875 GST_API_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1881 if (!gst_adaptive_demux_can_seek (demux)) { in gst_adaptive_demux_handle_seek_event()
1882 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1883 GST_API_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1888 if (gst_adaptive_demux_is_live (demux)) { in gst_adaptive_demux_handle_seek_event()
1893 if (!gst_adaptive_demux_get_live_seek_range (demux, &range_start, in gst_adaptive_demux_handle_seek_event()
1895 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1896 GST_API_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1898 GST_WARNING_OBJECT (demux, "Failure getting the live seek ranges"); in gst_adaptive_demux_handle_seek_event()
1902 GST_DEBUG_OBJECT (demux, in gst_adaptive_demux_handle_seek_event()
1925 GST_DEBUG_OBJECT (demux, in gst_adaptive_demux_handle_seek_event()
1934 GST_DEBUG_OBJECT (demux, in gst_adaptive_demux_handle_seek_event()
1943 GST_WARNING_OBJECT (demux, in gst_adaptive_demux_handle_seek_event()
1952 GST_WARNING_OBJECT (demux, in gst_adaptive_demux_handle_seek_event()
1962 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1963 GST_API_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1978 GST_DEBUG_OBJECT (demux, "seek event, %" GST_PTR_FORMAT, event); in gst_adaptive_demux_handle_seek_event()
1981 gst_segment_copy_into (&demux->segment, &oldsegment); in gst_adaptive_demux_handle_seek_event()
1986 GST_DEBUG_OBJECT (demux, "sending flush start"); in gst_adaptive_demux_handle_seek_event()
1989 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
1990 gst_adaptive_demux_push_src_event (demux, fevent); in gst_adaptive_demux_handle_seek_event()
1991 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_handle_seek_event()
1993 gst_adaptive_demux_stop_tasks (demux, FALSE); in gst_adaptive_demux_handle_seek_event()
1997 gst_adaptive_demux_stop_tasks (demux, FALSE); in gst_adaptive_demux_handle_seek_event()
2000 GST_ADAPTIVE_DEMUX_SEGMENT_LOCK (demux); in gst_adaptive_demux_handle_seek_event()
2015 gst_adaptive_demux_find_stream_for_pad (demux, pad))) { in gst_adaptive_demux_handle_seek_event()
2052 GST_DEBUG_OBJECT (demux, "Adapted snap seek to %" GST_PTR_FORMAT, event); in gst_adaptive_demux_handle_seek_event()
2056 ret = gst_segment_do_seek (&demux->segment, rate, format, flags, start_type, in gst_adaptive_demux_handle_seek_event()
2066 demux->segment.base = oldsegment.base; in gst_adaptive_demux_handle_seek_event()
2069 GST_DEBUG_OBJECT (demux, "Calling subclass seek: %" GST_PTR_FORMAT, event); in gst_adaptive_demux_handle_seek_event()
2071 ret = demux_class->seek (demux, event); in gst_adaptive_demux_handle_seek_event()
2076 gst_segment_copy_into (&oldsegment, &demux->segment); in gst_adaptive_demux_handle_seek_event()
2078 demux->priv->segment_seqnum = seqnum; in gst_adaptive_demux_handle_seek_event()
2080 GST_ADAPTIVE_DEMUX_SEGMENT_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
2085 GST_DEBUG_OBJECT (demux, "Sending flush stop on all pad"); in gst_adaptive_demux_handle_seek_event()
2093 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
2095 gst_adaptive_demux_push_src_event (demux, fevent); in gst_adaptive_demux_handle_seek_event()
2098 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_handle_seek_event()
2102 if (demux->next_streams) { in gst_adaptive_demux_handle_seek_event()
2105 gst_adaptive_demux_prepare_streams (demux, FALSE); in gst_adaptive_demux_handle_seek_event()
2106 gst_adaptive_demux_start_tasks (demux, TRUE); in gst_adaptive_demux_handle_seek_event()
2109 gst_adaptive_demux_get_period_start_time (demux); in gst_adaptive_demux_handle_seek_event()
2111 GST_ADAPTIVE_DEMUX_SEGMENT_LOCK (demux); in gst_adaptive_demux_handle_seek_event()
2112 gst_adaptive_demux_update_streams_segment (demux, demux->streams, in gst_adaptive_demux_handle_seek_event()
2114 gst_adaptive_demux_update_streams_segment (demux, demux->prepared_streams, in gst_adaptive_demux_handle_seek_event()
2116 GST_ADAPTIVE_DEMUX_SEGMENT_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
2125 if (demux->streams && demux->prepared_streams) { in gst_adaptive_demux_handle_seek_event()
2126 g_list_free_full (demux->prepared_streams, in gst_adaptive_demux_handle_seek_event()
2128 demux->prepared_streams = NULL; in gst_adaptive_demux_handle_seek_event()
2134 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
2135 g_mutex_lock (&demux->priv->preroll_lock); in gst_adaptive_demux_handle_seek_event()
2136 demux->priv->preroll_pending = 0; in gst_adaptive_demux_handle_seek_event()
2137 g_mutex_unlock (&demux->priv->preroll_lock); in gst_adaptive_demux_handle_seek_event()
2138 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_handle_seek_event()
2143 gst_adaptive_demux_start_tasks (demux, FALSE); in gst_adaptive_demux_handle_seek_event()
2146 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
2147 GST_API_UNLOCK (demux); in gst_adaptive_demux_handle_seek_event()
2157 GstAdaptiveDemux *demux; in gst_adaptive_demux_src_event() local
2159 demux = GST_ADAPTIVE_DEMUX_CAST (parent); in gst_adaptive_demux_src_event()
2167 if (seqnum == demux->priv->segment_seqnum) { in gst_adaptive_demux_src_event()
2173 return gst_adaptive_demux_handle_seek_event (demux, pad, event); in gst_adaptive_demux_src_event()
2178 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_src_event()
2179 stream = gst_adaptive_demux_find_stream_for_pad (demux, pad); in gst_adaptive_demux_src_event()
2182 if (!stream->cancelled && gst_adaptive_demux_is_running (demux) && in gst_adaptive_demux_src_event()
2192 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_src_event()
2195 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_src_event()
2217 GST_OBJECT_LOCK (demux); in gst_adaptive_demux_src_event()
2218 if (!GST_CLOCK_TIME_IS_VALID (demux->priv->qos_earliest_time) || in gst_adaptive_demux_src_event()
2219 earliest_time > demux->priv->qos_earliest_time) { in gst_adaptive_demux_src_event()
2220 demux->priv->qos_earliest_time = earliest_time; in gst_adaptive_demux_src_event()
2221 GST_DEBUG_OBJECT (demux, "qos_earliest_time %" GST_TIME_FORMAT, in gst_adaptive_demux_src_event()
2222 GST_TIME_ARGS (demux->priv->qos_earliest_time)); in gst_adaptive_demux_src_event()
2224 GST_OBJECT_UNLOCK (demux); in gst_adaptive_demux_src_event()
2238 GstAdaptiveDemux *demux; in gst_adaptive_demux_src_query() local
2245 demux = GST_ADAPTIVE_DEMUX_CAST (parent); in gst_adaptive_demux_src_query()
2246 demux_class = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_src_query()
2261 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_src_query()
2263 if (gst_adaptive_demux_is_live (demux)) { in gst_adaptive_demux_src_query()
2269 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_src_query()
2275 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_src_query()
2279 && g_atomic_int_get (&demux->priv->have_manifest)) { in gst_adaptive_demux_src_query()
2280 duration = demux_class->get_duration (demux); in gst_adaptive_demux_src_query()
2288 GST_LOG_OBJECT (demux, "GST_QUERY_DURATION returns %s with duration %" in gst_adaptive_demux_src_query()
2302 if (!g_atomic_int_get (&demux->priv->have_manifest)) { in gst_adaptive_demux_src_query()
2303 GST_INFO_OBJECT (demux, in gst_adaptive_demux_src_query()
2308 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_src_query()
2311 GST_INFO_OBJECT (demux, "Received GST_QUERY_SEEKING with format %d", fmt); in gst_adaptive_demux_src_query()
2314 gboolean can_seek = gst_adaptive_demux_can_seek (demux); in gst_adaptive_demux_src_query()
2318 if (gst_adaptive_demux_is_live (demux)) { in gst_adaptive_demux_src_query()
2319 ret = gst_adaptive_demux_get_live_seek_range (demux, &start, &stop); in gst_adaptive_demux_src_query()
2321 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_src_query()
2322 GST_INFO_OBJECT (demux, "can't answer seeking query"); in gst_adaptive_demux_src_query()
2326 duration = demux_class->get_duration (demux); in gst_adaptive_demux_src_query()
2332 GST_INFO_OBJECT (demux, "GST_QUERY_SEEKING returning with start : %" in gst_adaptive_demux_src_query()
2336 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_src_query()
2341 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_src_query()
2344 if (demux->manifest_uri) { in gst_adaptive_demux_src_query()
2347 gst_query_set_uri (query, demux->manifest_uri); in gst_adaptive_demux_src_query()
2351 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_src_query()
2366 gst_adaptive_demux_start_tasks (GstAdaptiveDemux * demux, in gst_adaptive_demux_start_tasks() argument
2371 if (!gst_adaptive_demux_is_running (demux)) { in gst_adaptive_demux_start_tasks()
2372 GST_DEBUG_OBJECT (demux, "Not starting tasks due to shutdown"); in gst_adaptive_demux_start_tasks()
2376 GST_INFO_OBJECT (demux, "Starting streams' tasks"); in gst_adaptive_demux_start_tasks()
2378 iter = start_preroll_streams ? demux->prepared_streams : demux->streams; in gst_adaptive_demux_start_tasks()
2397 gst_adaptive_demux_stop_manifest_update_task (GstAdaptiveDemux * demux) in gst_adaptive_demux_stop_manifest_update_task() argument
2399 gst_uri_downloader_cancel (demux->downloader); in gst_adaptive_demux_stop_manifest_update_task()
2401 gst_task_stop (demux->priv->updates_task); in gst_adaptive_demux_stop_manifest_update_task()
2403 g_mutex_lock (&demux->priv->updates_timed_lock); in gst_adaptive_demux_stop_manifest_update_task()
2404 GST_DEBUG_OBJECT (demux, "requesting stop of the manifest update task"); in gst_adaptive_demux_stop_manifest_update_task()
2405 demux->priv->stop_updates_task = TRUE; in gst_adaptive_demux_stop_manifest_update_task()
2406 g_cond_signal (&demux->priv->updates_timed_cond); in gst_adaptive_demux_stop_manifest_update_task()
2407 g_mutex_unlock (&demux->priv->updates_timed_lock); in gst_adaptive_demux_stop_manifest_update_task()
2412 gst_adaptive_demux_start_manifest_update_task (GstAdaptiveDemux * demux) in gst_adaptive_demux_start_manifest_update_task() argument
2414 GstAdaptiveDemuxClass *demux_class = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_start_manifest_update_task()
2416 if (gst_adaptive_demux_is_live (demux)) { in gst_adaptive_demux_start_manifest_update_task()
2417 gst_uri_downloader_reset (demux->downloader); in gst_adaptive_demux_start_manifest_update_task()
2418 g_mutex_lock (&demux->priv->updates_timed_lock); in gst_adaptive_demux_start_manifest_update_task()
2419 demux->priv->stop_updates_task = FALSE; in gst_adaptive_demux_start_manifest_update_task()
2420 g_mutex_unlock (&demux->priv->updates_timed_lock); in gst_adaptive_demux_start_manifest_update_task()
2422 if (demux_class->requires_periodical_playlist_update (demux)) { in gst_adaptive_demux_start_manifest_update_task()
2423 GST_DEBUG_OBJECT (demux, "requesting start of the manifest update task"); in gst_adaptive_demux_start_manifest_update_task()
2424 gst_task_start (demux->priv->updates_task); in gst_adaptive_demux_start_manifest_update_task()
2436 gst_adaptive_demux_stop_tasks (GstAdaptiveDemux * demux, gboolean stop_updates) in gst_adaptive_demux_stop_tasks() argument
2442 GST_LOG_OBJECT (demux, "Stopping tasks"); in gst_adaptive_demux_stop_tasks()
2445 gst_adaptive_demux_stop_manifest_update_task (demux); in gst_adaptive_demux_stop_tasks()
2447 list_to_process = demux->streams; in gst_adaptive_demux_stop_tasks()
2458 list_to_process = demux->prepared_streams; in gst_adaptive_demux_stop_tasks()
2461 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stop_tasks()
2462 g_mutex_lock (&demux->priv->preroll_lock); in gst_adaptive_demux_stop_tasks()
2463 g_cond_broadcast (&demux->priv->preroll_cond); in gst_adaptive_demux_stop_tasks()
2464 g_mutex_unlock (&demux->priv->preroll_lock); in gst_adaptive_demux_stop_tasks()
2465 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stop_tasks()
2467 g_mutex_lock (&demux->priv->manifest_update_lock); in gst_adaptive_demux_stop_tasks()
2468 g_cond_broadcast (&demux->priv->manifest_cond); in gst_adaptive_demux_stop_tasks()
2469 g_mutex_unlock (&demux->priv->manifest_update_lock); in gst_adaptive_demux_stop_tasks()
2476 list_to_process = demux->streams; in gst_adaptive_demux_stop_tasks()
2482 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stop_tasks()
2494 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stop_tasks()
2496 list_to_process = demux->prepared_streams; in gst_adaptive_demux_stop_tasks()
2499 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stop_tasks()
2501 gst_task_join (demux->priv->updates_task); in gst_adaptive_demux_stop_tasks()
2503 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stop_tasks()
2505 list_to_process = demux->streams; in gst_adaptive_demux_stop_tasks()
2513 list_to_process = demux->prepared_streams; in gst_adaptive_demux_stop_tasks()
2515 demux->priv->qos_earliest_time = GST_CLOCK_TIME_NONE; in gst_adaptive_demux_stop_tasks()
2520 gst_adaptive_demux_push_src_event (GstAdaptiveDemux * demux, GstEvent * event) in gst_adaptive_demux_push_src_event() argument
2525 for (iter = demux->streams; iter; iter = g_list_next (iter)) { in gst_adaptive_demux_push_src_event()
2568 _update_average_bitrate (GstAdaptiveDemux * demux, in _update_average_bitrate() argument
2586 gst_adaptive_demux_stream_update_current_bitrate (GstAdaptiveDemux * demux, in gst_adaptive_demux_stream_update_current_bitrate() argument
2592 if (demux->connection_speed) { in gst_adaptive_demux_stream_update_current_bitrate()
2593 GST_LOG_OBJECT (demux, "Connection-speed is set to %u kbps, using it", in gst_adaptive_demux_stream_update_current_bitrate()
2594 demux->connection_speed / 1000); in gst_adaptive_demux_stream_update_current_bitrate()
2595 stream->current_download_rate = demux->connection_speed; in gst_adaptive_demux_stream_update_current_bitrate()
2596 return demux->connection_speed; in gst_adaptive_demux_stream_update_current_bitrate()
2600 GST_DEBUG_OBJECT (demux, "Download bitrate is : %" G_GUINT64_FORMAT " bps", in gst_adaptive_demux_stream_update_current_bitrate()
2603 average_bitrate = _update_average_bitrate (demux, stream, fragment_bitrate); in gst_adaptive_demux_stream_update_current_bitrate()
2614 stream->current_download_rate *= demux->bitrate_limit; in gst_adaptive_demux_stream_update_current_bitrate()
2615 GST_DEBUG_OBJECT (demux, "Bitrate after bitrate limit (%0.2f): %" in gst_adaptive_demux_stream_update_current_bitrate()
2616 G_GUINT64_FORMAT, demux->bitrate_limit, stream->current_download_rate); in gst_adaptive_demux_stream_update_current_bitrate()
2623 GST_INFO_OBJECT (demux, "Halving reported bitrate for debugging"); in gst_adaptive_demux_stream_update_current_bitrate()
2635 gst_adaptive_demux_combine_flows (GstAdaptiveDemux * demux) in gst_adaptive_demux_combine_flows() argument
2641 for (iter = demux->streams; iter; iter = g_list_next (iter)) { in gst_adaptive_demux_combine_flows()
2664 gst_adaptive_demux_handle_preroll (GstAdaptiveDemux * demux, in gst_adaptive_demux_handle_preroll() argument
2667 demux->priv->preroll_pending--; in gst_adaptive_demux_handle_preroll()
2668 if (demux->priv->preroll_pending == 0) { in gst_adaptive_demux_handle_preroll()
2671 GST_DEBUG_OBJECT (demux, "All streams prerolled. exposing"); in gst_adaptive_demux_handle_preroll()
2672 gst_adaptive_demux_expose_streams (demux); in gst_adaptive_demux_handle_preroll()
2673 g_cond_broadcast (&demux->priv->preroll_cond); in gst_adaptive_demux_handle_preroll()
2684 GstAdaptiveDemux *demux = stream->demux; in gst_adaptive_demux_stream_push_buffer() local
2696 gst_adaptive_demux_stream_get_presentation_offset (demux, stream); in gst_adaptive_demux_stream_push_buffer()
2698 gst_adaptive_demux_get_period_start_time (demux); in gst_adaptive_demux_stream_push_buffer()
2700 GST_ADAPTIVE_DEMUX_SEGMENT_LOCK (demux); in gst_adaptive_demux_stream_push_buffer()
2701 if (demux->segment.rate < 0) in gst_adaptive_demux_stream_push_buffer()
2716 demux->segment.position) in gst_adaptive_demux_stream_push_buffer()
2717 demux->segment.position = in gst_adaptive_demux_stream_push_buffer()
2720 GST_ADAPTIVE_DEMUX_SEGMENT_UNLOCK (demux); in gst_adaptive_demux_stream_push_buffer()
2753 g_mutex_lock (&demux->priv->preroll_lock); in gst_adaptive_demux_stream_push_buffer()
2761 gst_adaptive_demux_handle_preroll (demux, stream); in gst_adaptive_demux_stream_push_buffer()
2762 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_push_buffer()
2765 GST_LOG_OBJECT (demux, "Stream %p sleeping for preroll", stream); in gst_adaptive_demux_stream_push_buffer()
2766 g_cond_wait (&demux->priv->preroll_cond, &demux->priv->preroll_lock); in gst_adaptive_demux_stream_push_buffer()
2769 GST_LOG_OBJECT (demux, "stream %p cancelled", stream); in gst_adaptive_demux_stream_push_buffer()
2771 g_mutex_unlock (&demux->priv->preroll_lock); in gst_adaptive_demux_stream_push_buffer()
2775 g_mutex_unlock (&demux->priv->preroll_lock); in gst_adaptive_demux_stream_push_buffer()
2776 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_push_buffer()
2780 GST_ADAPTIVE_DEMUX_SEGMENT_LOCK (demux); in gst_adaptive_demux_stream_push_buffer()
2783 GST_ADAPTIVE_DEMUX_SEGMENT_UNLOCK (demux); in gst_adaptive_demux_stream_push_buffer()
2808 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_push_buffer()
2842 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_push_buffer()
2862 gst_adaptive_demux_stream_finish_fragment_default (GstAdaptiveDemux * demux, in gst_adaptive_demux_stream_finish_fragment_default() argument
2869 return gst_adaptive_demux_stream_advance_fragment (demux, stream, in gst_adaptive_demux_stream_finish_fragment_default()
2877 gst_adaptive_demux_stream_data_received_default (GstAdaptiveDemux * demux, in gst_adaptive_demux_stream_data_received_default() argument
2885 * demux) in gst_adaptive_demux_requires_periodical_playlist_update_default()
2894 GstAdaptiveDemux *demux; in _src_chain() local
2898 demux = GST_ADAPTIVE_DEMUX_CAST (parent); in _src_chain()
2900 klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in _src_chain()
2902 GST_MANIFEST_LOCK (demux); in _src_chain()
2910 GST_MANIFEST_UNLOCK (demux); in _src_chain()
2922 gst_adaptive_demux_stream_get_presentation_offset (demux, stream); in _src_chain()
2924 gst_adaptive_demux_get_period_start_time (demux); in _src_chain()
2928 if (!klass->start_fragment (demux, stream)) { in _src_chain()
2942 GST_ADAPTIVE_DEMUX_SEGMENT_LOCK (demux); in _src_chain()
2948 demux->segment.position) in _src_chain()
2949 demux->segment.position = in _src_chain()
2951 GST_ADAPTIVE_DEMUX_SEGMENT_UNLOCK (demux); in _src_chain()
2981 GST_LOG_OBJECT (demux, in _src_chain()
2990 GST_WARNING_OBJECT (demux, "Bitrate for fragment not available"); in _src_chain()
3000 ret = klass->data_received (demux, stream, buffer); in _src_chain()
3007 GST_MANIFEST_UNLOCK (demux); in _src_chain()
3017 GST_ELEMENT_FLOW_ERROR (demux, ret); in _src_chain()
3031 ret = klass->finish_fragment (demux, stream); in _src_chain()
3047 GST_MANIFEST_UNLOCK (demux); in _src_chain()
3079 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (stream->demux); in gst_adaptive_demux_eos_handling()
3101 ret = klass->finish_fragment (stream->demux, stream); in gst_adaptive_demux_eos_handling()
3112 GstAdaptiveDemux *demux = stream->demux; in _src_event() local
3117 GST_MANIFEST_LOCK (demux); in _src_event()
3130 GST_MANIFEST_UNLOCK (demux); in _src_event()
3168 gst_adaptive_demux_get_monotonic_time (stream->demux) - in _uri_handler_probe()
3190 gst_adaptive_demux_get_monotonic_time (stream->demux) - in _uri_handler_probe()
3214 gst_adaptive_demux_stream_wait_manifest_update (GstAdaptiveDemux * demux, in gst_adaptive_demux_stream_wait_manifest_update() argument
3223 GST_DEBUG_OBJECT (demux, "No fragment left but live playlist, wait a bit"); in gst_adaptive_demux_stream_wait_manifest_update()
3231 g_mutex_lock (&demux->priv->manifest_update_lock); in gst_adaptive_demux_stream_wait_manifest_update()
3233 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_wait_manifest_update()
3235 g_cond_wait (&demux->priv->manifest_cond, in gst_adaptive_demux_stream_wait_manifest_update()
3236 &demux->priv->manifest_update_lock); in gst_adaptive_demux_stream_wait_manifest_update()
3237 g_mutex_unlock (&demux->priv->manifest_update_lock); in gst_adaptive_demux_stream_wait_manifest_update()
3239 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_wait_manifest_update()
3252 if (gst_adaptive_demux_stream_update_fragment_info (demux, stream) == in gst_adaptive_demux_stream_wait_manifest_update()
3254 GST_DEBUG_OBJECT (demux, "new fragment available, " in gst_adaptive_demux_stream_wait_manifest_update()
3260 if (!gst_adaptive_demux_is_live (demux)) { in gst_adaptive_demux_stream_wait_manifest_update()
3261 GST_DEBUG_OBJECT (demux, "Not live anymore, " in gst_adaptive_demux_stream_wait_manifest_update()
3267 GST_DEBUG_OBJECT (demux, "Retrying now"); in gst_adaptive_demux_stream_wait_manifest_update()
3277 GstAdaptiveDemux *demux = stream->demux; in gst_adaptive_demux_stream_update_source() local
3299 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_update_source()
3302 gst_bin_remove (GST_BIN_CAST (demux), src); in gst_adaptive_demux_stream_update_source()
3303 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_update_source()
3304 GST_DEBUG_OBJECT (demux, "Can't re-use old source element"); in gst_adaptive_demux_stream_update_source()
3308 GST_DEBUG_OBJECT (demux, "Re-using old source element"); in gst_adaptive_demux_stream_update_source()
3314 GST_DEBUG_OBJECT (demux, "Failed to re-use old source element: %s", in gst_adaptive_demux_stream_update_source()
3319 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_update_source()
3322 gst_bin_remove (GST_BIN_CAST (demux), src); in gst_adaptive_demux_stream_update_source()
3323 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_update_source()
3356 GST_ELEMENT_ERROR (demux, CORE, MISSING_PLUGIN, in gst_adaptive_demux_stream_update_source()
3411 GST_WARNING_OBJECT (demux, in gst_adaptive_demux_stream_update_source()
3434 gst_bin_add (GST_BIN_CAST (demux), stream->src); in gst_adaptive_demux_stream_update_source()
3444 GST_OBJECT_CAST (demux)); in gst_adaptive_demux_stream_update_source()
3499 gst_adaptive_demux_stream_download_uri (GstAdaptiveDemux * demux, in gst_adaptive_demux_stream_download_uri() argument
3518 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_download_uri()
3533 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_uri()
3541 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_uri()
3544 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_uri()
3549 GST_TIME_AS_USECONDS (gst_adaptive_demux_get_monotonic_time (demux)); in gst_adaptive_demux_stream_download_uri()
3559 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_download_uri()
3562 GST_WARNING_OBJECT (demux, "Could not sync state for src element"); in gst_adaptive_demux_stream_download_uri()
3563 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_uri()
3576 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_uri()
3593 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_uri()
3615 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_download_uri()
3617 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_download_uri()
3639 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_uri()
3663 GstAdaptiveDemux *demux = stream->demux; in gst_adaptive_demux_stream_download_header_fragment() local
3667 GST_DEBUG_OBJECT (demux, "Fetching header %s %" G_GINT64_FORMAT "-%" in gst_adaptive_demux_stream_download_header_fragment()
3672 ret = gst_adaptive_demux_stream_download_uri (demux, stream, in gst_adaptive_demux_stream_download_header_fragment()
3682 GST_DEBUG_OBJECT (demux, in gst_adaptive_demux_stream_download_header_fragment()
3687 ret = gst_adaptive_demux_stream_download_uri (demux, stream, in gst_adaptive_demux_stream_download_header_fragment()
3703 GstAdaptiveDemux *demux = stream->demux; in gst_adaptive_demux_stream_download_fragment() local
3704 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_stream_download_fragment()
3768 gst_adaptive_demux_stream_download_uri (demux, stream, url, in gst_adaptive_demux_stream_download_fragment()
3816 gst_adaptive_demux_stream_download_uri (demux, stream, url, in gst_adaptive_demux_stream_download_fragment()
3839 live = gst_adaptive_demux_is_live (demux); in gst_adaptive_demux_stream_download_fragment()
3854 if (!gst_adaptive_demux_stream_has_next_fragment (demux, stream)) in gst_adaptive_demux_stream_download_fragment()
3860 if (!gst_adaptive_demux_get_live_seek_range (demux, &range_start, in gst_adaptive_demux_stream_download_fragment()
3864 if (demux->segment.position < range_start) { in gst_adaptive_demux_stream_download_fragment()
3870 GST_DEBUG_OBJECT (demux, "Calling update_fragment_info"); in gst_adaptive_demux_stream_download_fragment()
3871 ret = gst_adaptive_demux_stream_update_fragment_info (demux, stream); in gst_adaptive_demux_stream_download_fragment()
3878 } else if (demux->segment.position > range_stop) { in gst_adaptive_demux_stream_download_fragment()
3881 gst_adaptive_demux_stream_get_fragment_waiting_time (demux, stream); in gst_adaptive_demux_stream_download_fragment()
3889 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_download_fragment()
3893 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_fragment()
3902 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_fragment()
3909 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_fragment()
3921 } else if (!gst_adaptive_demux_stream_has_next_fragment (demux, stream)) { in gst_adaptive_demux_stream_download_fragment()
3944 GST_ELEMENT_ERROR (demux, STREAM, DEMUX, in gst_adaptive_demux_stream_download_fragment()
3959 GstAdaptiveDemux *demux = stream->demux; in gst_adaptive_demux_stream_download_loop() local
3960 GstClockTime next_download = gst_adaptive_demux_get_monotonic_time (demux); in gst_adaptive_demux_stream_download_loop()
3966 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_loop()
3977 GST_ADAPTIVE_DEMUX_SEGMENT_LOCK (demux); in gst_adaptive_demux_stream_download_loop()
3978 if (demux->segment.rate > 0) { in gst_adaptive_demux_stream_download_loop()
3979 if (GST_CLOCK_TIME_IS_VALID (demux->segment.stop) in gst_adaptive_demux_stream_download_loop()
3981 GST_ADAPTIVE_DEMUX_SEGMENT_UNLOCK (demux); in gst_adaptive_demux_stream_download_loop()
3987 if (GST_CLOCK_TIME_IS_VALID (demux->segment.start) in gst_adaptive_demux_stream_download_loop()
3989 GST_ADAPTIVE_DEMUX_SEGMENT_UNLOCK (demux); in gst_adaptive_demux_stream_download_loop()
3995 GST_ADAPTIVE_DEMUX_SEGMENT_UNLOCK (demux); in gst_adaptive_demux_stream_download_loop()
3998 if (G_UNLIKELY (demux->priv->old_streams != NULL)) { in gst_adaptive_demux_stream_download_loop()
3999 GList *old_streams = demux->priv->old_streams; in gst_adaptive_demux_stream_download_loop()
4000 demux->priv->old_streams = NULL; in gst_adaptive_demux_stream_download_loop()
4031 GST_DEBUG_OBJECT (demux, "Downstream position: %" in gst_adaptive_demux_stream_download_loop()
4039 for (iter = demux->streams; iter != NULL; iter = g_list_next (iter)) { in gst_adaptive_demux_stream_download_loop()
4053 GST_ADAPTIVE_DEMUX_SEGMENT_LOCK (demux); in gst_adaptive_demux_stream_download_loop()
4068 gst_adaptive_demux_stream_get_presentation_offset (demux, stream); in gst_adaptive_demux_stream_download_loop()
4069 period_start = gst_adaptive_demux_get_period_start_time (demux); in gst_adaptive_demux_stream_download_loop()
4072 gst_adaptive_demux_stream_seek (demux, stream, demux->segment.rate >= 0, in gst_adaptive_demux_stream_download_loop()
4082 gst_event_set_seqnum (seg_event, demux->priv->segment_seqnum); in gst_adaptive_demux_stream_download_loop()
4083 GST_ADAPTIVE_DEMUX_SEGMENT_UNLOCK (demux); in gst_adaptive_demux_stream_download_loop()
4093 live = gst_adaptive_demux_is_live (demux); in gst_adaptive_demux_stream_download_loop()
4096 GST_DEBUG_OBJECT (demux, "Calling update_fragment_info"); in gst_adaptive_demux_stream_download_loop()
4097 ret = gst_adaptive_demux_stream_update_fragment_info (demux, stream); in gst_adaptive_demux_stream_download_loop()
4105 gst_adaptive_demux_stream_get_fragment_waiting_time (demux, stream); in gst_adaptive_demux_stream_download_loop()
4108 gst_adaptive_demux_get_monotonic_time (demux) + wait_time; in gst_adaptive_demux_stream_download_loop()
4113 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_download_loop()
4118 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_loop()
4122 gst_adaptive_demux_wait_until (demux->realtime_clock, in gst_adaptive_demux_stream_download_loop()
4129 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_loop()
4143 next_download = gst_adaptive_demux_get_monotonic_time (demux); in gst_adaptive_demux_stream_download_loop()
4167 if (gst_adaptive_demux_is_live (demux) in gst_adaptive_demux_stream_download_loop()
4168 && (demux->segment.rate == 1.0 in gst_adaptive_demux_stream_download_loop()
4169 || gst_adaptive_demux_stream_in_live_seek_range (demux, in gst_adaptive_demux_stream_download_loop()
4172 GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_stream_download_loop()
4175 if (!demux_class->requires_periodical_playlist_update (demux)) { in gst_adaptive_demux_stream_download_loop()
4176 ret = gst_adaptive_demux_update_manifest (demux); in gst_adaptive_demux_stream_download_loop()
4181 } else if (!gst_adaptive_demux_has_next_period (demux) && in gst_adaptive_demux_stream_download_loop()
4182 gst_adaptive_demux_stream_wait_manifest_update (demux, stream)) { in gst_adaptive_demux_stream_download_loop()
4193 if (gst_adaptive_demux_combine_flows (demux) == GST_FLOW_EOS) { in gst_adaptive_demux_stream_download_loop()
4194 if (gst_adaptive_demux_has_next_period (demux)) { in gst_adaptive_demux_stream_download_loop()
4197 gst_adaptive_demux_advance_period (demux); in gst_adaptive_demux_stream_download_loop()
4208 ret = gst_adaptive_demux_combine_flows (demux); in gst_adaptive_demux_stream_download_loop()
4210 GST_ELEMENT_FLOW_ERROR (demux, ret); in gst_adaptive_demux_stream_download_loop()
4218 for (iter = demux->streams; iter; iter = g_list_next (iter)) { in gst_adaptive_demux_stream_download_loop()
4229 gboolean is_live = gst_adaptive_demux_is_live (demux); in gst_adaptive_demux_stream_download_loop()
4230 GST_WARNING_OBJECT (demux, "Error while downloading fragment"); in gst_adaptive_demux_stream_download_loop()
4244 if (gst_adaptive_demux_update_manifest (demux) == GST_FLOW_OK) { in gst_adaptive_demux_stream_download_loop()
4246 GST_DEBUG_OBJECT (demux, "Updated the playlist"); in gst_adaptive_demux_stream_download_loop()
4254 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_download_loop()
4259 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_loop()
4263 gst_adaptive_demux_wait_until (demux->realtime_clock, in gst_adaptive_demux_stream_download_loop()
4268 GST_DEBUG_OBJECT (demux, "Retrying now"); in gst_adaptive_demux_stream_download_loop()
4270 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_loop()
4282 && gst_adaptive_demux_update_manifest (demux) == GST_FLOW_OK) { in gst_adaptive_demux_stream_download_loop()
4283 GST_DEBUG_OBJECT (demux, "Updated the playlist"); in gst_adaptive_demux_stream_download_loop()
4293 if (demux->next_streams == NULL && demux->prepared_streams == NULL) { in gst_adaptive_demux_stream_download_loop()
4301 GST_ERROR_OBJECT (demux, "Can't push EOS on non-exposed pad"); in gst_adaptive_demux_stream_download_loop()
4307 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_download_loop()
4324 gst_message_new_error (GST_OBJECT_CAST (demux), stream->last_error, in gst_adaptive_demux_stream_download_loop()
4334 gst_message_new_error (GST_OBJECT_CAST (demux), err, in gst_adaptive_demux_stream_download_loop()
4346 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_download_loop()
4349 gst_bin_remove (GST_BIN_CAST (demux), src); in gst_adaptive_demux_stream_download_loop()
4350 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_download_loop()
4353 gst_element_post_message (GST_ELEMENT_CAST (demux), msg); in gst_adaptive_demux_stream_download_loop()
4360 gst_adaptive_demux_updates_loop (GstAdaptiveDemux * demux) in gst_adaptive_demux_updates_loop() argument
4363 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_updates_loop()
4370 GST_DEBUG_OBJECT (demux, "Started updates task"); in gst_adaptive_demux_updates_loop()
4372 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_updates_loop()
4375 gst_adaptive_demux_get_monotonic_time (demux) + in gst_adaptive_demux_updates_loop()
4376 klass->get_manifest_update_interval (demux) * GST_USECOND; in gst_adaptive_demux_updates_loop()
4379 while (gst_adaptive_demux_is_live (demux)) { in gst_adaptive_demux_updates_loop()
4383 GST_DEBUG_OBJECT (demux, "Wait for next playlist update"); in gst_adaptive_demux_updates_loop()
4385 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_updates_loop()
4387 g_mutex_lock (&demux->priv->updates_timed_lock); in gst_adaptive_demux_updates_loop()
4388 if (demux->priv->stop_updates_task) { in gst_adaptive_demux_updates_loop()
4389 g_mutex_unlock (&demux->priv->updates_timed_lock); in gst_adaptive_demux_updates_loop()
4392 gst_adaptive_demux_wait_until (demux->realtime_clock, in gst_adaptive_demux_updates_loop()
4393 &demux->priv->updates_timed_cond, in gst_adaptive_demux_updates_loop()
4394 &demux->priv->updates_timed_lock, next_update); in gst_adaptive_demux_updates_loop()
4395 g_mutex_unlock (&demux->priv->updates_timed_lock); in gst_adaptive_demux_updates_loop()
4397 g_mutex_lock (&demux->priv->updates_timed_lock); in gst_adaptive_demux_updates_loop()
4398 if (demux->priv->stop_updates_task) { in gst_adaptive_demux_updates_loop()
4399 g_mutex_unlock (&demux->priv->updates_timed_lock); in gst_adaptive_demux_updates_loop()
4402 g_mutex_unlock (&demux->priv->updates_timed_lock); in gst_adaptive_demux_updates_loop()
4404 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_updates_loop()
4406 GST_DEBUG_OBJECT (demux, "Updating playlist"); in gst_adaptive_demux_updates_loop()
4408 ret = gst_adaptive_demux_update_manifest (demux); in gst_adaptive_demux_updates_loop()
4413 demux->priv->update_failed_count++; in gst_adaptive_demux_updates_loop()
4414 if (demux->priv->update_failed_count <= DEFAULT_FAILED_COUNT) { in gst_adaptive_demux_updates_loop()
4415 GST_WARNING_OBJECT (demux, "Could not update the playlist, flow: %s", in gst_adaptive_demux_updates_loop()
4417 next_update = gst_adaptive_demux_get_monotonic_time (demux) in gst_adaptive_demux_updates_loop()
4418 + klass->get_manifest_update_interval (demux) * GST_USECOND; in gst_adaptive_demux_updates_loop()
4420 GST_ELEMENT_ERROR (demux, STREAM, FAILED, in gst_adaptive_demux_updates_loop()
4422 GST_DEBUG_OBJECT (demux, "Stopped updates task because of error"); in gst_adaptive_demux_updates_loop()
4423 gst_task_stop (demux->priv->updates_task); in gst_adaptive_demux_updates_loop()
4424 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_updates_loop()
4428 GST_DEBUG_OBJECT (demux, "Updated playlist successfully"); in gst_adaptive_demux_updates_loop()
4429 demux->priv->update_failed_count = 0; in gst_adaptive_demux_updates_loop()
4431 gst_adaptive_demux_get_monotonic_time (demux) + in gst_adaptive_demux_updates_loop()
4432 klass->get_manifest_update_interval (demux) * GST_USECOND; in gst_adaptive_demux_updates_loop()
4435 g_mutex_lock (&demux->priv->manifest_update_lock); in gst_adaptive_demux_updates_loop()
4436 g_cond_broadcast (&demux->priv->manifest_cond); in gst_adaptive_demux_updates_loop()
4437 g_mutex_unlock (&demux->priv->manifest_update_lock); in gst_adaptive_demux_updates_loop()
4441 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_updates_loop()
4445 GST_DEBUG_OBJECT (demux, "Stop updates task request detected."); in gst_adaptive_demux_updates_loop()
4461 GstAdaptiveDemux *demux = stream->demux; in gst_adaptive_demux_stream_push_event() local
4470 GST_MANIFEST_UNLOCK (demux); in gst_adaptive_demux_stream_push_event()
4479 GST_MANIFEST_LOCK (demux); in gst_adaptive_demux_stream_push_event()
4486 gst_adaptive_demux_is_live (GstAdaptiveDemux * demux) in gst_adaptive_demux_is_live() argument
4488 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_is_live()
4491 return klass->is_live (demux); in gst_adaptive_demux_is_live()
4497 gst_adaptive_demux_stream_seek (GstAdaptiveDemux * demux, in gst_adaptive_demux_stream_seek() argument
4501 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_stream_seek()
4510 gst_adaptive_demux_stream_has_next_fragment (GstAdaptiveDemux * demux, in gst_adaptive_demux_stream_has_next_fragment() argument
4513 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_stream_has_next_fragment()
4527 gst_adaptive_demux_stream_advance_fragment (GstAdaptiveDemux * demux, in gst_adaptive_demux_stream_advance_fragment() argument
4534 gst_adaptive_demux_stream_advance_fragment_unlocked (demux, stream, in gst_adaptive_demux_stream_advance_fragment()
4544 gst_adaptive_demux_stream_advance_fragment_unlocked (GstAdaptiveDemux * demux, in gst_adaptive_demux_stream_advance_fragment_unlocked() argument
4547 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_stream_advance_fragment_unlocked()
4563 gst_element_post_message (GST_ELEMENT_CAST (demux), in gst_adaptive_demux_stream_advance_fragment_unlocked()
4564 gst_message_new_element (GST_OBJECT_CAST (demux), in gst_adaptive_demux_stream_advance_fragment_unlocked()
4567 demux->manifest_uri, "uri", G_TYPE_STRING, in gst_adaptive_demux_stream_advance_fragment_unlocked()
4576 GST_ADAPTIVE_DEMUX_SEGMENT_LOCK (demux); in gst_adaptive_demux_stream_advance_fragment_unlocked()
4577 if (GST_CLOCK_TIME_IS_VALID (duration) && demux->segment.rate > 0) { in gst_adaptive_demux_stream_advance_fragment_unlocked()
4579 gst_adaptive_demux_stream_get_presentation_offset (demux, stream); in gst_adaptive_demux_stream_advance_fragment_unlocked()
4581 gst_adaptive_demux_get_period_start_time (demux); in gst_adaptive_demux_stream_advance_fragment_unlocked()
4588 demux->segment.position) in gst_adaptive_demux_stream_advance_fragment_unlocked()
4589 demux->segment.position = in gst_adaptive_demux_stream_advance_fragment_unlocked()
4592 GST_ADAPTIVE_DEMUX_SEGMENT_UNLOCK (demux); in gst_adaptive_demux_stream_advance_fragment_unlocked()
4597 if (demux->segment.rate != 1.0 && gst_adaptive_demux_is_live (demux)) { in gst_adaptive_demux_stream_advance_fragment_unlocked()
4598 if (!gst_adaptive_demux_stream_in_live_seek_range (demux, stream)) in gst_adaptive_demux_stream_advance_fragment_unlocked()
4602 } else if (gst_adaptive_demux_is_live (demux) in gst_adaptive_demux_stream_advance_fragment_unlocked()
4603 || gst_adaptive_demux_stream_has_next_fragment (demux, stream)) { in gst_adaptive_demux_stream_advance_fragment_unlocked()
4610 GST_TIME_AS_USECONDS (gst_adaptive_demux_get_monotonic_time (demux)); in gst_adaptive_demux_stream_advance_fragment_unlocked()
4613 if (gst_adaptive_demux_stream_select_bitrate (demux, stream, in gst_adaptive_demux_stream_advance_fragment_unlocked()
4614 gst_adaptive_demux_stream_update_current_bitrate (demux, stream))) { in gst_adaptive_demux_stream_advance_fragment_unlocked()
4620 if (G_UNLIKELY (demux->next_streams)) { in gst_adaptive_demux_stream_advance_fragment_unlocked()
4628 for (iter = demux->streams; iter; iter = g_list_next (iter)) { in gst_adaptive_demux_stream_advance_fragment_unlocked()
4640 GST_DEBUG_OBJECT (demux, "Subclass wants new pads " in gst_adaptive_demux_stream_advance_fragment_unlocked()
4642 gst_adaptive_demux_prepare_streams (demux, FALSE); in gst_adaptive_demux_stream_advance_fragment_unlocked()
4643 gst_adaptive_demux_start_tasks (demux, TRUE); in gst_adaptive_demux_stream_advance_fragment_unlocked()
4645 GST_LOG_OBJECT (demux, "Not switching yet - ongoing downloads"); in gst_adaptive_demux_stream_advance_fragment_unlocked()
4656 demux, GstAdaptiveDemuxStream * stream, guint64 bitrate) in gst_adaptive_demux_stream_select_bitrate()
4658 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_stream_select_bitrate()
4667 gst_adaptive_demux_stream_update_fragment_info (GstAdaptiveDemux * demux, in gst_adaptive_demux_stream_update_fragment_info() argument
4670 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_stream_update_fragment_info()
4704 demux, GstAdaptiveDemuxStream * stream) in gst_adaptive_demux_stream_get_fragment_waiting_time()
4706 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_stream_get_fragment_waiting_time()
4715 gst_adaptive_demux_update_manifest_default (GstAdaptiveDemux * demux) in gst_adaptive_demux_update_manifest_default() argument
4717 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_update_manifest_default()
4723 download = gst_uri_downloader_fetch_uri (demux->downloader, in gst_adaptive_demux_update_manifest_default()
4724 demux->manifest_uri, NULL, TRUE, TRUE, TRUE, &error); in gst_adaptive_demux_update_manifest_default()
4726 g_free (demux->manifest_uri); in gst_adaptive_demux_update_manifest_default()
4727 g_free (demux->manifest_base_uri); in gst_adaptive_demux_update_manifest_default()
4729 demux->manifest_uri = g_strdup (download->redirect_uri); in gst_adaptive_demux_update_manifest_default()
4730 demux->manifest_base_uri = NULL; in gst_adaptive_demux_update_manifest_default()
4732 demux->manifest_uri = g_strdup (download->uri); in gst_adaptive_demux_update_manifest_default()
4733 demux->manifest_base_uri = g_strdup (download->redirect_uri); in gst_adaptive_demux_update_manifest_default()
4738 ret = klass->update_manifest_data (demux, buffer); in gst_adaptive_demux_update_manifest_default()
4743 GST_WARNING_OBJECT (demux, "Failed to download manifest: %s", in gst_adaptive_demux_update_manifest_default()
4754 gst_adaptive_demux_update_manifest (GstAdaptiveDemux * demux) in gst_adaptive_demux_update_manifest() argument
4756 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_update_manifest()
4759 ret = klass->update_manifest (demux); in gst_adaptive_demux_update_manifest()
4764 duration = klass->get_duration (demux); in gst_adaptive_demux_update_manifest()
4766 GST_DEBUG_OBJECT (demux, in gst_adaptive_demux_update_manifest()
4769 gst_element_post_message (GST_ELEMENT (demux), in gst_adaptive_demux_update_manifest()
4770 gst_message_new_duration_changed (GST_OBJECT (demux))); in gst_adaptive_demux_update_manifest()
4772 GST_DEBUG_OBJECT (demux, in gst_adaptive_demux_update_manifest()
4781 if (gst_adaptive_demux_is_live (demux) && in gst_adaptive_demux_update_manifest()
4782 klass->requires_periodical_playlist_update (demux)) { in gst_adaptive_demux_update_manifest()
4783 gst_adaptive_demux_start_manifest_update_task (demux); in gst_adaptive_demux_update_manifest()
4785 gst_adaptive_demux_stop_manifest_update_task (demux); in gst_adaptive_demux_update_manifest()
4815 gst_adaptive_demux_has_next_period (GstAdaptiveDemux * demux) in gst_adaptive_demux_has_next_period() argument
4817 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_has_next_period()
4821 ret = klass->has_next_period (demux); in gst_adaptive_demux_has_next_period()
4822 GST_DEBUG_OBJECT (demux, "Has next period: %d", ret); in gst_adaptive_demux_has_next_period()
4828 gst_adaptive_demux_advance_period (GstAdaptiveDemux * demux) in gst_adaptive_demux_advance_period() argument
4830 GstAdaptiveDemuxClass *klass = GST_ADAPTIVE_DEMUX_GET_CLASS (demux); in gst_adaptive_demux_advance_period()
4834 GST_DEBUG_OBJECT (demux, "Advancing to next period"); in gst_adaptive_demux_advance_period()
4835 klass->advance_period (demux); in gst_adaptive_demux_advance_period()
4836 gst_adaptive_demux_prepare_streams (demux, FALSE); in gst_adaptive_demux_advance_period()
4837 gst_adaptive_demux_start_tasks (demux, TRUE); in gst_adaptive_demux_advance_period()
4845 gst_adaptive_demux_get_monotonic_time (GstAdaptiveDemux * demux) in gst_adaptive_demux_get_monotonic_time() argument
4847 g_return_val_if_fail (demux != NULL, GST_CLOCK_TIME_NONE); in gst_adaptive_demux_get_monotonic_time()
4848 return gst_clock_get_time (demux->realtime_clock); in gst_adaptive_demux_get_monotonic_time()
4859 gst_adaptive_demux_get_client_now_utc (GstAdaptiveDemux * demux) in gst_adaptive_demux_get_client_now_utc() argument
4866 rtc_now = gst_clock_get_time (demux->realtime_clock); in gst_adaptive_demux_get_client_now_utc()
4867 utc_now_in_us = demux->clock_offset + GST_TIME_AS_USECONDS (rtc_now); in gst_adaptive_demux_get_client_now_utc()
4885 gst_adaptive_demux_is_running (GstAdaptiveDemux * demux) in gst_adaptive_demux_is_running() argument
4887 return g_atomic_int_get (&demux->running); in gst_adaptive_demux_is_running()
4994 gst_adaptive_demux_get_qos_earliest_time (GstAdaptiveDemux * demux) in gst_adaptive_demux_get_qos_earliest_time() argument
4998 GST_OBJECT_LOCK (demux); in gst_adaptive_demux_get_qos_earliest_time()
4999 earliest = demux->priv->qos_earliest_time; in gst_adaptive_demux_get_qos_earliest_time()
5000 GST_OBJECT_UNLOCK (demux); in gst_adaptive_demux_get_qos_earliest_time()