From 2af0f16f1fdadf1e85493f8506d441df09199fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Sat, 23 Oct 2010 13:18:24 +0200 Subject: mingw32-w64 port: '-no-undefined' part - use -no-undefined flag only for building shared libraries (libxine, plugins) - plugins LDFLAGS unification - move -no-undefined into LDFLAGS_NOUNDEFINED - attributes.m4 fix --- src/xine-engine/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am index 17dd96b10..576c61b14 100644 --- a/src/xine-engine/Makefile.am +++ b/src/xine-engine/Makefile.am @@ -10,7 +10,7 @@ lib_LTLIBRARIES = libxine.la XINEUTILS_LIB = $(top_builddir)/src/xine-utils/libxineutils.la DEF_FILE = libxine-$(XINE_MAJOR).def if WIN32 -def_ldflags="-Wl,--output-def,$(DEF_FILE)" +def_ldflags=-Wl,--output-def,$(DEF_FILE) $(LDFLAGS_NOUNDEFINED) endif libxine_la_SOURCES = xine.c metronom.c configfile.c buffer.c \ -- cgit v1.2.3 From a2ef98093f3e40a889c12ecca6e236505fdcbf05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Sat, 30 Oct 2010 11:35:28 +0200 Subject: Using binary mode when checking configfile. New configfile would not be written only when switching binaries for different platforms. --- src/xine-engine/configfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 484d1d16f..507f0a81d 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -1012,8 +1012,8 @@ void xine_config_save (xine_t *xine, const char *filename) { lprintf("backing up configfile to %s\n", temp); - f_backup = fopen(temp, "w"); - f_config = fopen(filename, "r"); + f_backup = fopen(temp, "wb"); + f_config = fopen(filename, "rb"); if (f_config && f_backup && (stat(filename, &config_stat) == 0)) { char *buf = NULL; -- cgit v1.2.3 From 3a70a11d2871085ef8dcffdc81e3865c134de4d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Sat, 30 Oct 2010 11:40:31 +0200 Subject: Proper place for log mutex initialization (logging can start after xine_new()). Fixed a leak. --- src/xine-engine/xine.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 842d864ba..ea90e45a4 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -1561,6 +1561,8 @@ void xine_exit (xine_t *this) { if(this->port_ticket) this->port_ticket->dispose(this->port_ticket); + pthread_mutex_destroy(&this->log_lock); + #if defined(WIN32) WSACleanup(); #endif @@ -1604,6 +1606,7 @@ xine_t *xine_new (void) { * log buffers */ memset(this->log_buffers, 0, sizeof(this->log_buffers)); + pthread_mutex_init (&this->log_lock, NULL); #ifdef WIN32 @@ -1696,7 +1699,6 @@ void xine_init (xine_t *this) { * locks */ pthread_mutex_init (&this->streams_lock, NULL); - pthread_mutex_init (&this->log_lock, NULL); /* initialize color conversion tables and functions */ init_yuv_conversion(); -- cgit v1.2.3 From afc21c050464eec01f98a34455581e2f5d877c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Tue, 30 Nov 2010 23:13:18 +0100 Subject: Various small memory leaks in xine engine. --- src/xine-engine/events.c | 1 + src/xine-engine/info_helper.c | 5 ++--- src/xine-engine/xine.c | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/events.c b/src/xine-engine/events.c index a51813adc..04a599c50 100644 --- a/src/xine-engine/events.c +++ b/src/xine-engine/events.c @@ -193,6 +193,7 @@ void xine_event_dispose_queue (xine_event_queue_t *queue) { while ( (event = xine_event_get (queue)) ) { xine_event_free (event); } + xine_list_delete(queue->events); pthread_mutex_destroy(&queue->lock); pthread_cond_destroy(&queue->new_event); diff --git a/src/xine-engine/info_helper.c b/src/xine-engine/info_helper.c index e45336d98..9d0302cc1 100644 --- a/src/xine-engine/info_helper.c +++ b/src/xine-engine/info_helper.c @@ -241,9 +241,6 @@ static void meta_info_set_unlocked_encoding(xine_stream_t *stream, int info, con xprintf(stream->xine, XINE_VERBOSITY_LOG, _("info_helper: unsupported conversion %s -> UTF-8, no conversion performed\n"), enc); - if (system_enc) - free(system_enc); - if (cd != (iconv_t)-1) { char *utf8_value; ICONV_CONST char *inbuf; @@ -273,6 +270,8 @@ static void meta_info_set_unlocked_encoding(xine_stream_t *stream, int info, con return; } } + + free(system_enc); } #endif diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index ea90e45a4..fad1785b4 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -654,6 +654,7 @@ xine_stream_t *xine_stream_new (xine_t *this, pthread_mutexattr_init(&attr); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init (&stream->frontend_lock, &attr); + pthread_mutexattr_destroy(&attr); /* * Clear meta/stream info @@ -1488,6 +1489,8 @@ static void xine_dispose_internal (xine_stream_t *stream) { stream->metronom->exit (stream->metronom); + xine_list_delete(stream->event_queues); + pthread_mutex_lock(&stream->xine->streams_lock); ite = xine_list_find(stream->xine->streams, stream); if (ite) { @@ -1532,7 +1535,6 @@ void xine_dispose (xine_stream_t *stream) { if (stream->osd_renderer) stream->osd_renderer->close( stream->osd_renderer ); - _x_refcounter_dec(stream->refcounter); } -- cgit v1.2.3 From d741057648d888a9967d6b80153d026d124a76ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Thu, 20 Jan 2011 23:38:16 +0100 Subject: Avoid video clock errors due to decoder flush at discontinuity. H.264 decoders store a couple of frames in their display picture buffer. Calling flush before discontinuity my yield images with pts beyond pts boundery and therefore cause clock errors. Calling discontinuity before flush resets all pts to 0 before yielding the images. --HG-- extra : transplant_source : %9CNpV%B5%83%83%23%F5%C3%09%E43%E2%DFo.%7E%D9%C7 --- src/xine-engine/video_decoder.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index f70bb82bb..984a71bf8 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.c @@ -307,10 +307,10 @@ static void *video_decoder_loop (void *stream_gen) { if (stream->video_decoder_plugin) { running_ticket->acquire(running_ticket, 0); - /* it might be a long time before we get back from a discontinuity, so we better flush - * the decoder before */ - stream->video_decoder_plugin->flush (stream->video_decoder_plugin); stream->video_decoder_plugin->discontinuity (stream->video_decoder_plugin); + /* it might be a long time before we get back from a handle_video_discontinuity, + * so we better flush the decoder before */ + stream->video_decoder_plugin->flush (stream->video_decoder_plugin); running_ticket->release(running_ticket, 0); } @@ -323,10 +323,10 @@ static void *video_decoder_loop (void *stream_gen) { if (stream->video_decoder_plugin) { running_ticket->acquire(running_ticket, 0); - /* it might be a long time before we get back from a discontinuity, so we better flush - * the decoder before */ - stream->video_decoder_plugin->flush (stream->video_decoder_plugin); stream->video_decoder_plugin->discontinuity (stream->video_decoder_plugin); + /* it might be a long time before we get back from a handle_video_discontinuity, + * so we better flush the decoder before */ + stream->video_decoder_plugin->flush (stream->video_decoder_plugin); running_ticket->release(running_ticket, 0); } -- cgit v1.2.3 From 1bd15df285dcf1650c03460d530b7ffea656241a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Fri, 21 Jan 2011 00:28:23 +0100 Subject: Disable decoder flush at discontinuity to avoid decoding errors. Flushing the decoder at a pts wrap causes decoding errors for images after the pts wrap. It is likely that the flush is still required for the issues it was introduced (DVD still images), but they may have been resolved differently meanwhile (e. g. by supporting sequence end code). So for now a configureable option has been introduced which keeps the current behaviour by default. --HG-- extra : transplant_source : %9Cs%D1%9A%E5Sk%27%18%A6%94%5D%AB%0Dd%CA%7E%7E%BA%FD --- src/xine-engine/video_decoder.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index 984a71bf8..ef61edebd 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.c @@ -102,6 +102,11 @@ int _x_spu_decoder_sleep(xine_stream_t *stream, int64_t next_spu_vpts) return thread_vacant; } +static void video_decoder_update_disable_flush_at_discontinuity(void *disable_decoder_flush_at_discontinuity, xine_cfg_entry_t *entry) +{ + *(int *)disable_decoder_flush_at_discontinuity = entry->num_value; +} + static void *video_decoder_loop (void *stream_gen) { buf_element_t *buf; @@ -112,6 +117,7 @@ static void *video_decoder_loop (void *stream_gen) { int prof_video_decode = -1; int prof_spu_decode = -1; uint32_t buftype_unknown = 0; + int disable_decoder_flush_at_discontinuity; #ifndef WIN32 /* nice(-value) will fail silently for normal users. @@ -127,6 +133,15 @@ static void *video_decoder_loop (void *stream_gen) { if (prof_spu_decode == -1) prof_spu_decode = xine_profiler_allocate_slot ("spu decoder"); + disable_decoder_flush_at_discontinuity = stream->xine->config->register_bool(stream->xine->config, "engine.decoder.disable_flush_at_discontinuity", 0, + _("disable decoder flush at discontinuity"), + _("when watching live tv a discontinuity happens for example about every 26.5 hours due to a pts wrap.\n" + "flushing the decoder at that time causes decoding errors for images after the pts wrap.\n" + "to avoid the decoding errors, decoder flush at discontinuity should be disabled.\n\n" + "WARNING: as the flush was introduced to fix some issues when playing DVD still images, it is\n" + "likely that these issues may reappear in case they haven't been fixed differently meanwhile.\n"), + 20, video_decoder_update_disable_flush_at_discontinuity, &disable_decoder_flush_at_discontinuity); + while (running) { lprintf ("getting buffer...\n"); @@ -310,7 +325,8 @@ static void *video_decoder_loop (void *stream_gen) { stream->video_decoder_plugin->discontinuity (stream->video_decoder_plugin); /* it might be a long time before we get back from a handle_video_discontinuity, * so we better flush the decoder before */ - stream->video_decoder_plugin->flush (stream->video_decoder_plugin); + if (!disable_decoder_flush_at_discontinuity) + stream->video_decoder_plugin->flush (stream->video_decoder_plugin); running_ticket->release(running_ticket, 0); } @@ -326,7 +342,8 @@ static void *video_decoder_loop (void *stream_gen) { stream->video_decoder_plugin->discontinuity (stream->video_decoder_plugin); /* it might be a long time before we get back from a handle_video_discontinuity, * so we better flush the decoder before */ - stream->video_decoder_plugin->flush (stream->video_decoder_plugin); + if (!disable_decoder_flush_at_discontinuity) + stream->video_decoder_plugin->flush (stream->video_decoder_plugin); running_ticket->release(running_ticket, 0); } -- cgit v1.2.3 From 1e7611bff8c1e5cb6b54f9bcba006a5f18aeb6ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Fri, 21 Jan 2011 00:51:59 +0100 Subject: Disable decoder flush from video out to avoid decoding errors. Video out flushes the decoder when it runs out of images for displaying, because the decoder hasn't delivered new frames for quite a while. But flushing the decoder causes decoding errors for images after the flush. It is likely that the flush is still required for the issues it was introduced (DVD still images), but they may have been resolved differently meanwhile (e. g. by supporting sequence end code). So for now a configureable option has been introduced which keeps the current behaviour by default. --HG-- extra : transplant_source : %AB%B3u%1F%E7%3D%10%0C%3D%40%B2%B0%CB%8E%84%FE%E6%87p%AA --- src/xine-engine/video_out.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/xine-engine') diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 26ad98290..bd7333a0b 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -1124,6 +1124,11 @@ static void paused_loop( vos_t *this, int64_t vpts ) pthread_mutex_unlock( &this->free_img_buf_queue->mutex ); } +static void video_out_update_disable_flush_from_video_out(void *disable_decoder_flush_from_video_out, xine_cfg_entry_t *entry) +{ + *(int *)disable_decoder_flush_from_video_out = entry->num_value; +} + static void *video_out_loop (void *this_gen) { int64_t vpts, diff; @@ -1131,6 +1136,7 @@ static void *video_out_loop (void *this_gen) { vos_t *this = (vos_t *) this_gen; int64_t next_frame_vpts = 0; int64_t usec_to_sleep; + int disable_decoder_flush_from_video_out; #ifndef WIN32 /* nice(-value) will fail silently for normal users. @@ -1141,6 +1147,16 @@ static void *video_out_loop (void *this_gen) { nice(-2); #endif /* WIN32 */ + disable_decoder_flush_from_video_out = this->xine->config->register_bool(this->xine->config, "engine.decoder.disable_flush_from_video_out", 0, + _("disable decoder flush from video out"), + _("video out causes a decoder flush when video out runs out of frames for displaying,\n" + "because the decoder hasn't deliverd new frames for quite a while.\n" + "flushing the decoder causes decoding errors for images decoded after the flush.\n" + "to avoid the decoding errors, decoder flush at video out should be disabled.\n\n" + "WARNING: as the flush was introduced to fix some issues when playing DVD still images, it is\n" + "likely that these issues may reappear in case they haven't been fixed differently meanwhile.\n"), + 20, video_out_update_disable_flush_from_video_out, &disable_decoder_flush_from_video_out); + /* * here it is - the heart of xine (or rather: one of the hearts * of xine) : the video output loop @@ -1191,7 +1207,7 @@ static void *video_out_loop (void *this_gen) { ite = xine_list_next(this->streams, ite)) { xine_stream_t *stream = xine_list_get_value(this->streams, ite); if (stream == XINE_ANON_STREAM) continue; - if (stream->video_decoder_plugin && stream->video_fifo) { + if (stream->video_decoder_plugin && stream->video_fifo && !disable_decoder_flush_from_video_out) { buf_element_t *buf; lprintf ("flushing current video decoder plugin\n"); -- cgit v1.2.3