GNOME Bugzilla – Bug 576534
ts-offset property of appsink is ineffective
Last modified: 2009-05-28 09:46:09 UTC
Please describe the problem: on my dreambox architecture, the ts-offset of the appsink element influences the subtitle handover time in no way, when used as text-sink element for a playbin2 pipeline with e.g. internal mkv subtitles Steps to reproduce: 1. took wim's playbin-text example 2009-03-23 15:59:36 2. changed it to not quit the main loop on warnings 3. chose a ts-offset of 5*GST_SECOND 4. crosscompiled it 5. root@dm8000:/testProgs# ./playbin-text file:///media/hdd/movie/mkv/with_utf8_sub.mkv Actual results: ** (playbin-text:26660): WARNING **: gstplaysink.c(1224): gen_audio_chain (): /GstPlayBin2:playbin20/GstPlaySink:playsink0: Volume/mute is not available H264 have codec data..! H264 high profile@3.1 MIMETYPE video/x-h264 VIDEO_SET_STREAMTYPE, 1 MIMETYPE audio/x-ac3 ** (playbin-text:26660): WARNING **: gstbin.c(2240): gst_bin_do_latency_func (): /GstPlayBin2:playbin20: Failed to configure latency of 0:00:00.000000000 ** Message: received a subtitle at position 0:00:44.501000000, running_time 0:00:37.592988000 00000000 (0x2eb5ce60): 2d 59 6f 2c 20 72 75 6e 20 74 68 65 20 62 61 6c -Yo, run the bal 00000010 (0x2eb5ce70): 6c 2c 20 66 6f 6f 6c 21 0d 0a 2d 43 6f 6d 65 20 l, fool!..-Come 00000020 (0x2eb5ce80): 6f 6e 2c 20 6e 6f 77 2e on, now. ** Message: received a subtitle at position 0:00:46.962000000, running_time 0:00:39.972334000 00000000 (0x2eb7f682): 54 68 61 74 27 73 20 67 6f 6f 64 2e 20 47 6f 6f That's good. Goo 00000010 (0x2eb7f692): 64 2e 0d 0a 44 6f 20 69 74 2e d...Do it. the subtitles are displayed the same exact time as when compiling without ts-offset Expected results: i'd expect the subtitles to be displayed with the correct offset chosen Does this happen every time? yes Other information: maybe it has to do with the "Failed to configure latency of 0:00:00.000000000" warning?
Can you paste the output with ts-offset=0 for comparison?
this is with a ts-offset of 0: root@dm8000:/testProgs# ./playbin-text file:///media/hdd/movie/mkv/with_utf8_sub.mkv ** (playbin-text:2548): WARNING **: gstplaysink.c(1224): gen_audio_chain (): /GstPlayBin2:playbin20/GstPlaySink:playsink0: Volume/mute is not available H264 have codec data..! H264 high profile@3.1 MIMETYPE video/x-h264 VIDEO_SET_STREAMTYPE, 1 MIMETYPE audio/x-ac3 ** (playbin-text:2548): WARNING **: gstbin.c(2240): gst_bin_do_latency_func (): /GstPlayBin2:playbin20: Failed to configure latency of 0:00:00.000000000 VIDEO_EVENT 1 VIDEO_EVENT 2 VIDEO_EVENT 16 VIDEO_EVENT 1 VIDEO_EVENT 2 ** Message: received a subtitle at position 0:00:44.501000000, running_time 0:00:37.678559000 00000000 (0x2e3c8bc0): 2d 59 6f 2c 20 72 75 6e 20 74 68 65 20 62 61 6c -Yo, run the bal 00000010 (0x2e3c8bd0): 6c 2c 20 66 6f 6f 6c 21 0d 0a 2d 43 6f 6d 65 20 l, fool!..-Come 00000020 (0x2e3c8be0): 6f 6e 2c 20 6e 6f 77 2e on, now. ** Message: received a subtitle at position 0:00:46.962000000, running_time 0:00:39.920584000 00000000 (0x2e347eea): 54 68 61 74 27 73 20 67 6f 6f 64 2e 20 47 6f 6f That's good. Goo 00000010 (0x2e347efa): 64 2e 0d 0a 44 6f 20 69 74 2e d...Do it.
with this code in our app i can work around the issue by calculating the needed offset and then delaying it with a proprietary timer call: void eServiceMP3::gstCBsubtitleAvail(GstElement *appsink, gpointer user_data) { eServiceMP3 *_this = (eServiceMP3*)user_data; GstBuffer *buffer; g_signal_emit_by_name (appsink, "pull-buffer", &buffer); if (buffer) { GstFormat fmt = GST_FORMAT_TIME; gint64 buf_pos = GST_BUFFER_TIMESTAMP(buffer); gint64 duration_ns = GST_BUFFER_DURATION(buffer); size_t len = GST_BUFFER_SIZE(buffer); unsigned char line[len+1]; memcpy(line, GST_BUFFER_DATA(buffer), len); line[len] = 0; eDebug("got new subtitle @ buf_pos = %lld ns (in pts=%lld): '%s' ", buf_pos, buf_pos/11111, line); if ( _this->m_subtitle_widget ) { ePangoSubtitlePage page; gRGB rgbcol(0xD0,0xD0,0xD0); page.m_elements.push_back(ePangoSubtitlePageElement(rgbcol, (const char*)line)); page.show_pts = buf_pos / 11111L; page.m_timeout = duration_ns / 1000000; _this->m_subtitle_pages.push_back(page); _this->pushSubtitles(); } } } void eServiceMP3::pushSubtitles() { ePangoSubtitlePage page; GstClockTime base_time; pts_t running_pts; GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_playbin),"subtitle_sink"); GstClock *clock; clock = gst_element_get_clock (appsink); do { page = m_subtitle_pages.front(); base_time = gst_element_get_base_time (appsink); running_pts = ( gst_clock_get_time (clock) - base_time ) / 11111L; gint64 diff_ms = ( page.show_pts - running_pts ) / 90; // eDebug("eServiceMP3::pushSubtitles show_pts = %lld running_pts = %lld diff = %lld", page.show_pts, running_pts, diff_ms); if ( diff_ms > 20 ) { // eDebug("m_subtitle_sync_timer->start(%lld,1)", diff_ms); m_subtitle_sync_timer->start(diff_ms, 1); break; } else { m_subtitle_widget->setPage(page); m_subtitle_pages.pop_front(); } } while ( !m_subtitle_pages.empty() ); gst_object_unref (clock); }
unfortunately my "workaround/solution thingie" leads to the problem that subtitles arrive way to late after having seeked once, because the running pts get reset to 0 on that event :/ problem acknowledged with base 0.10.22.2: root@dm8000:/testProgs# ./playbin-text file:///media/hdd/movie/mkv/with_utf8_sub.mkv ** Message: fakesink ** (playbin-text:11289): WARNING **: gstplaysink.c(1469): gen_audio_chain (): /GstPlayBin2:playbin20/GstPlaySink:playsink0: Volume/mute is not available H264 have codec data..! H264 high profile@3.1 MIMETYPE video/x-h264 VIDEO_SET_STREAMTYPE, 1 MIMETYPE audio/x-ac3 VIDEO_EVENT 1 ** Message: received a subtitle at position 0:00:44.501000000, running_time 0:00:37.704778000 00000000 (0x2eb30738): 2d 59 6f 2c 20 72 75 6e 20 74 68 65 20 62 61 6c -Yo, run the bal 00000010 (0x2eb30748): 6c 2c 20 66 6f 6f 6c 21 0d 0a 2d 43 6f 6d 65 20 l, fool!..-Come 00000020 (0x2eb30758): 6f 6e 2c 20 6e 6f 77 2e on, now. ** Message: received a subtitle at position 0:00:46.962000000, running_time 0:00:39.943716000 00000000 (0x2eb0ef82): 54 68 61 74 27 73 20 67 6f 6f 64 2e 20 47 6f 6f That's good. Goo 00000010 (0x2eb0ef92): 64 2e 0d 0a 44 6f 20 69 74 2e d...Do it. root@dm8000:/testProgs# ./playbin-text-3sec file:///media/hdd/movie/mkv/with_utf8_sub.mkv ** Message: fakesink ** (playbin-text-3sec:11353): WARNING **: gstplaysink.c(1469): gen_audio_chain (): /GstPlayBin2:playbin20/GstPlaySink:playsink0: Volume/mute is not available MIMETYPE audio/x-ac3 H264 have codec data..! H264 high profile@3.1 MIMETYPE video/x-h264 VIDEO_SET_STREAMTYPE, 1 ** Message: received a subtitle at position 0:00:44.501000000, running_time 0:00:37.639500000 00000000 (0x2ec20030): 2d 59 6f 2c 20 72 75 6e 20 74 68 65 20 62 61 6c -Yo, run the bal 00000010 (0x2ec20040): 6c 2c 20 66 6f 6f 6c 21 0d 0a 2d 43 6f 6d 65 20 l, fool!..-Come 00000020 (0x2ec20050): 6f 6e 2c 20 6e 6f 77 2e on, now. ** Message: received a subtitle at position 0:00:46.962000000, running_time 0:00:40.018309000 00000000 (0x2eb6fb12): 54 68 61 74 27 73 20 67 6f 6f 64 2e 20 47 6f 6f That's good. Goo 00000010 (0x2eb6fb22): 64 2e 0d 0a 44 6f 20 69 74 2e d...Do it.
i'm gonna abandon this bug since the issue is resolved due to introducing a clock providing method in our audiosink. thanks for the assistance doing that to you guys!