palinek / pvr.sledovanitv.cz

Kodi's sledovanitv.cz client addon
GNU General Public License v2.0
30 stars 14 forks source link

Add support for use of inputstream.adaptive addon #6

Closed palinek closed 6 years ago

palinek commented 6 years ago

@peak3d Please, can you have a quick look?

  1. Is this enough to make use of inputstream.adaptive?
  2. Would it be better to require the inpustream.adaptive addon in our addon.xml? (if yes, is there a possibility to require only some min. version?)
  3. I'm not able to make the stream play, but I don't know the reasoning. Could you have a look at this debug?
    11:53:28.011 T:139858882990016   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): FillStreamProperties properties[inputstream.adaptive.manifest_type]=hls
    11:53:28.011 T:139858882990016   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): FillStreamProperties properties[inputstreamaddon]=inputstream.adaptive
    11:53:28.011 T:139858882990016   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): FillStreamProperties properties[isrealtimestream]=true
    11:53:28.011 T:139858882990016   DEBUG: AddOnLog: PVR Client for sledovanitv.cz (unofficial): FillStreamProperties properties[streamurl]=http://sledovanitv.cz/vlc/api-channel/stv1sk.m3u8?PHPSESSID=1m7p741om15srvd29dr8hsrnf0&quality=40&capabilities=adaptive%2Ch265
    11:53:28.015 T:139858882990016   DEBUG: ------ Window Init (Pointer.xml) ------
    11:53:28.032 T:139858882990016   DEBUG: CPlayerCoreFactory::GetPlayers(pvr://channels/tv/All channels/pvr.sledovanitv.cz_1.pvr)
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: system rules
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: matches rule: system rules
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: mms/udp
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: lastfm/shout
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtmp
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtsp
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: streams
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: matches rule: streams
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: aacp/sdp
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: mp2
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: dvd
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: dvdimage
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: sdp/asf
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: nsv
    11:53:28.032 T:139858882990016   DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: radio
    11:53:28.032 T:139858882990016   DEBUG: CPlayerCoreFactory::GetPlayers: matched 0 rules with players
    11:53:28.032 T:139858882990016   DEBUG: CPlayerCoreFactory::GetPlayers: adding videodefaultplayer (VideoPlayer)
    11:53:28.032 T:139858882990016   DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=0
    11:53:28.032 T:139858882990016   DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=1
    11:53:28.032 T:139858882990016   DEBUG: CPlayerCoreFactory::GetPlayers: added 1 players
    11:53:28.038 T:139858882990016   DEBUG: Radio UECP (RDS) Processor - new CDVDRadioRDSData
    11:53:28.038 T:139858882990016  NOTICE: VideoPlayer::OpenFile: pvr://channels/tv/All channels/pvr.sledovanitv.cz_1.pvr
    11:53:28.038 T:139858882990016   DEBUG: OnPlayBackStarted: CApplication::OnPlayBackStarted
    11:53:28.038 T:139857473033984   DEBUG: Thread VideoPlayer start, auto delete: false
    11:53:28.038 T:139857473033984  NOTICE: Creating InputStream
    11:53:28.039 T:139857473033984   DEBUG: ADDON: Dll Initializing - InputStream Adaptive
    11:53:28.039 T:139857473033984   DEBUG: SECTION:LoadDLL(/home/palco/.kodi/addons/inputstream.adaptive/inputstream.adaptive.so.2.2.25)
    11:53:28.039 T:139857473033984   DEBUG: Loading: /home/palco/.kodi/addons/inputstream.adaptive/inputstream.adaptive.so.2.2.25
    11:53:28.040 T:139858026690304   DEBUG: Loading settings for pvr://channels/tv/All channels/pvr.sledovanitv.cz_1.pvr
    11:53:28.058 T:139857473033984    INFO: AddOnLog: InputStream Adaptive: SetVideoResolution (916 x 575)
    11:53:28.058 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: Open()
    11:53:28.058 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: found inputstream.adaptive.manifest_type: hls
    11:53:28.059 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: Initial bandwidth: 4000000
    11:53:28.059 T:139857473033984   DEBUG: CAddonSettings[inputstream.adaptive]: loading setting definitions
    11:53:28.059 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: MAXRESOLUTION selected: 0
    11:53:28.060 T:139857473033984   DEBUG: CAddonSettings[inputstream.adaptive]: loading setting definitions
    11:53:28.060 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: MAXRESOLUTIONSECURE selected: 0
    11:53:28.060 T:139857473033984   DEBUG: CAddonSettings[inputstream.adaptive]: loading setting definitions
    11:53:28.060 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: STREAMSELECTION selected: 0
    11:53:28.060 T:139857473033984   DEBUG: CAddonSettings[inputstream.adaptive]: loading setting definitions
    11:53:28.061 T:139857473033984   DEBUG: Previous line repeats 1 times.
    11:53:28.061 T:139857473033984   DEBUG: CurlFile::Open(0x7f32ec009070) http://sledovanitv.cz/vlc/api-channel/stv1sk.m3u8?PHPSESSID=1m7p741om15srvd29dr8hsrnf0&quality=40&capabilities=adaptive%2Ch265
    11:53:28.061 T:139857473033984    INFO: easy_acquire - Created session to http://sledovanitv.cz
    11:53:28.065 T:139858882990016   DEBUG: CPlayerGUIInfo::InitCurrentItem(pvr://channels/tv/All channels/pvr.sledovanitv.cz_1.pvr)
    11:53:28.065 T:139858882963200   DEBUG: CAnnouncementManager - Announcement: OnChanged from xbmc
    11:53:28.065 T:139858882963200   DEBUG: GOT ANNOUNCEMENT, type: 1024, from xbmc, message OnChanged
    11:53:28.073 T:139858882990016   DEBUG: CPlayerGUIInfo::InitCurrentItem(pvr://channels/tv/All channels/pvr.sledovanitv.cz_1.pvr)
    11:53:28.073 T:139858882963200   DEBUG: CAnnouncementManager - Announcement: OnChanged from xbmc
    11:53:28.073 T:139858882963200   DEBUG: GOT ANNOUNCEMENT, type: 1024, from xbmc, message OnChanged
    11:53:28.073 T:139858882963200   DEBUG: CAnnouncementManager - Announcement: OnPlay from xbmc
    11:53:28.073 T:139858882963200   DEBUG: GOT ANNOUNCEMENT, type: 1, from xbmc, message OnPlay
    11:53:28.287 T:139857473033984   DEBUG: CCurlFile::Open - effective URL: <http://31.47.102.130:7909/moderntv/stream/jednotka/61-hls/live.m3u8?_cdn_session=10224748232&_cdn_timestamp=1534672408&_cdn_token=08c13e1f3c4d936c8553d875801915d86513c33b>
    11:53:28.287 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: Effective URL http://31.47.102.130:7909/moderntv/stream/jednotka/61-hls/live.m3u8?_cdn_session=10224748232&_cdn_timestamp=1534672408&_cdn_token=08c13e1f3c4d936c8553d875801915d86513c33b
    11:53:28.288 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: Download http://sledovanitv.cz/vlc/api-channel/stv1sk.m3u8?PHPSESSID=1m7p741om15srvd29dr8hsrnf0&quality=40&capabilities=adaptive%2Ch265 finished
    11:53:28.290 T:139857473033984    INFO: AddOnLog: InputStream Adaptive: Successfully parsed .mpd file. #Streams: 2 Type: live, Download speed: 0.0000 Bytes/s
    11:53:28.290 T:139857473033984   DEBUG: CAddonSettings[inputstream.adaptive]: loading setting definitions
    11:53:28.292 T:139857473033984   DEBUG: Previous line repeats 2 times.
    11:53:28.292 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: GetCapabilities()
    11:53:28.292 T:139857473033984  NOTICE: Creating Demuxer
    11:53:28.292 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: GetStreamIds()
    11:53:28.292 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: GetStream(1)
    11:53:28.293 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: GetStream(2)
    11:53:28.293 T:139857473033984   DEBUG: CDVDDemuxClient::RequestStream(): added/updated stream 1 with codec_id 27
    11:53:28.293 T:139857473033984   DEBUG: CDVDDemuxClient::RequestStream(): added/updated stream 2 with codec_id 86018
    11:53:28.293 T:139857473033984  NOTICE: Opening stream: 1 source: 256
    11:53:28.293 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: OpenStream(1)
    11:53:28.293 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: Selecting stream with conditions: w: 916, h: 575, bw: 3600000
    11:53:28.294 T:139857473033984   DEBUG: CurlFile::Open(0x7f32ec009070) http://31.47.102.130:7909/moderntv/stream/jednotka/61-hls/live-media.m3u8?_cdn_session=10224748232&_cdn_timestamp=1534672408&_cdn_token=37a08d57662a3c9ac302668a35fab9513c76b145
    11:53:28.294 T:139857473033984    INFO: easy_acquire - Created session to http://31.47.102.130
    11:53:28.336 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: Download http://31.47.102.130:7909/moderntv/stream/jednotka/61-hls/live-media.m3u8?_cdn_session=10224748232&_cdn_timestamp=1534672408&_cdn_token=37a08d57662a3c9ac302668a35fab9513c76b145 finished
    11:53:28.338 T:139857489819392   DEBUG: CurlFile::ParseAndCorrectUrl() adding custom header option 'connection: keep-alive'
    11:53:28.338 T:139857489819392   DEBUG: CurlFile::Open(0x7f32f4002d50) http://31.47.102.130:7909/moderntv/stream/jednotka/61-hls/1534240383-000M-02213720-02213637.ts?_cdn_session=10224748232&_cdn_timestamp=1534672408&_cdn_token=692b5a62788f2b03c2f2b06dbc430f7e7fbbf399
    11:53:28.452 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: GetStream(1)
    11:53:28.452 T:139857473033984   DEBUG: CDVDDemuxClient::RequestStream(): added/updated stream 1 with codec_id 173
    11:53:28.452 T:139857473033984 WARNING: OpenStream - Unsupported stream 1. Stream disabled.
    11:53:28.452 T:139857473033984  NOTICE: Opening stream: 2 source: 256
    11:53:28.452 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: OpenStream(2)
    11:53:28.452 T:139857473033984  NOTICE: Finding audio codec for: 86018
    11:53:28.455 T:139857473033984  NOTICE: CDVDAudioCodecFFmpeg::Open() Successful opened audio decoder aac
    11:53:28.455 T:139857473033984  NOTICE: Creating audio thread
    11:53:28.455 T:139857436968704   DEBUG: Thread VideoPlayerAudio start, auto delete: false
    11:53:28.455 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: EnableStream(1: false)
    11:53:28.455 T:139857436968704  NOTICE: running thread: CVideoPlayerAudio::Process()
    11:53:28.456 T:139857489819392   DEBUG: AddOnLog: InputStream Adaptive: Download http://31.47.102.130:7909/moderntv/stream/jednotka/61-hls/1534240383-000M-02213720-02213637.ts?_cdn_session=10224748232&_cdn_timestamp=1534672408&_cdn_token=692b5a62788f2b03c2f2b06dbc430f7e7fbbf399 finished, average download speed: 183448.8750
    11:53:28.457 T:139857473033984   DEBUG: CVideoPlayer::SetCaching - caching state 2
    11:53:28.457 T:139857473033984   DEBUG: CDVDClock::SetSpeedAdjust - adjusted:0.000000
    11:53:28.458 T:139857473033984   DEBUG: CVideoPlayer::HandleMessages - player 1 reported state: 0
    11:53:28.458 T:139858247546624   DEBUG: OnAVChange: CApplication::OnAVChange
    11:53:28.458 T:139857473033984   DEBUG: CDVDClock::SetSpeedAdjust - adjusted:-0.050000
    11:53:28.458 T:139858882963200   DEBUG: CAnnouncementManager - Announcement: OnAVChange from xbmc
    11:53:28.458 T:139858882963200   DEBUG: GOT ANNOUNCEMENT, type: 1, from xbmc, message OnAVChange
    11:53:28.458 T:139857473033984    INFO: Process - eof reading from demuxer
    11:53:28.458 T:139857473033984  NOTICE: CVideoPlayer::OnExit()
    11:53:28.458 T:139857473033984  NOTICE: VideoPlayer: eof, waiting for queues to empty
    11:53:28.458 T:139857473033984  NOTICE: Closing stream player 1
    11:53:28.458 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: EnableStream(2: false)
    11:53:28.458 T:139857473033984  NOTICE: Waiting for audio thread to exit
    11:53:28.465 T:139857436968704  NOTICE: thread end: CVideoPlayerAudio::OnExit()
    11:53:28.465 T:139857436968704   DEBUG: Thread VideoPlayerAudio 139857436968704 terminating
    11:53:28.465 T:139857473033984  NOTICE: Closing audio device
    11:53:28.465 T:139857473033984  NOTICE: Deleting audio codec
    11:53:28.466 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: Close()
    11:53:28.466 T:139857473033984   DEBUG: AddOnLog: InputStream Adaptive: Session::~Session()
    11:53:28.467 T:139857473033984   DEBUG: SECTION:UnloadDll(/home/palco/.kodi/addons/inputstream.adaptive/inputstream.adaptive.so.2.2.25)
    11:53:28.467 T:139857473033984    INFO: ADDON: Dll Destroyed - InputStream Adaptive
    11:53:28.467 T:139857473033984   DEBUG: Thread VideoPlayer 139857473033984 terminating
    11:53:28.468 T:139858026690304   DEBUG: OnPlayBackEnded: CApplication::OnPlayBackEnded
    11:53:28.468 T:139858882963200   DEBUG: CAnnouncementManager - Announcement: OnStop from xbmc
    11:53:28.468 T:139858882963200   DEBUG: GOT ANNOUNCEMENT, type: 1, from xbmc, message OnStop
    11:53:28.469 T:139858882990016  NOTICE: CVideoPlayer::CloseFile()
    11:53:28.469 T:139858882990016  NOTICE: VideoPlayer: waiting for threads to exit
    11:53:28.469 T:139858882990016  NOTICE: VideoPlayer: finished waiting
    11:53:28.469 T:139858882990016   DEBUG: DeleteRenderer - deleting renderer
    11:53:28.469 T:139858882990016   DEBUG: LinuxRendererGL: Cleaning up GL resources
    11:53:28.469 T:139858882990016  NOTICE: CVideoPlayer::CloseFile()
    11:53:28.469 T:139858882990016  NOTICE: VideoPlayer: waiting for threads to exit
    11:53:28.469 T:139858882990016  NOTICE: VideoPlayer: finished waiting
    11:53:28.473 T:139858882990016   DEBUG: Radio UECP (RDS) Processor - delete ~CDVDRadioRDSData
peak3d commented 6 years ago

1.) seems fine to me, I picked the master m3u8 and pasted into strm file and it works well. 2.) Not necessary as long you make adaptive optional. But - if someone activates adaptive, you should check (programmatically) if inputstream.adaptive is installed / enabled. 3.) Looks odd, because the playlist in strm file is working. Let me give your addon a try...

palinek commented 6 years ago

you should check (programmatically) if inputstream.adaptive is installed / enabled.

How to do that? :)

palinek commented 6 years ago

I picked the master m3u8 and pasted into strm file and it works well.

...so I tried it as well, with the file contents as:

#KODIPROP:inputstreamaddon=inputstream.adaptive
#KODIPROP:inputstream.adaptive.manifest_type=hls
http://sledovanitv.cz/vlc/api-channel/stv1sk.m3u8?PHPSESSID=qd9oktb3p4nmpp8p4or9pelkk1&quality=40&capabilities=adaptive%2Ch265

and it works also here. So I really don't get why it doesn't work when used in the pvr addon...

peak3d commented 6 years ago

You are right, there is currently no "native" possibility to check if inputstream is installed / enabled, we'll have to add some functionality into kodi.

The current .ts reader in inputstream.adaptive is not capable of parsing hevc codec extra data (only h.264 / mpeg4). When playing strm file VideoPlayer is falling back to ffmpeg, this fallback does not work for pvr triggered streams.

For now you should not use inputstream.adaptive for hevc streams in ts container, simply remove the listitem properties and be happy with ffmpeg.

palinek commented 6 years ago

The current .ts reader in inputstream.adaptive is not capable of parsing hevc codec extra data (only h.264 / mpeg4)

Right... if I switch to h.264 (this provider can serve h.264 or h.265 based on client request), channels/streams are played well.

When playing strm file VideoPlayer is falling back to ffmpeg, this fallback does not work for pvr triggered streams.

Why not?

peak3d commented 6 years ago

Why not

Under investigation, no clue yet

palinek commented 6 years ago

Just testing the streams with inpusttream.adaptive... and by using it, we're getting new functionality for free -> now seek works perfectly for timeshift -> EPG tags already started, but not finished yet (which wasn't the case by using the standard kodi's playing capability).

peak3d commented 6 years ago

There will be more timeshift functionality in the future, I'll need more time to implement the GetStreamTimes API.

palinek commented 6 years ago

you should check (programmatically) if inputstream.adaptive is installed / enabled

Just tested...and if the inputstream.adaptive is disabled, kodi "ignores the adaptive properties" and falls back to ffmpeg.

palinek commented 6 years ago

...I believe, it's OK now for regular use... @peak3d thanks for your time and all advices.

peak3d commented 6 years ago

I'll push hevc extradata changes for ts streams later

peak3d commented 6 years ago

https://github.com/peak3d/inputstream.adaptive/commit/036f01443c0370dd05b795318f9d496a982ef34b

palinek commented 6 years ago

peak3d/inputstream.adaptive@036f014

Great! I definitely don't understand any line of that code, but now it works as a charm here with h.265.

Just one note: in the "video settings" for the h.265 there is no codec information shown with the inputstream.adaptive. It shows:

palinek commented 5 years ago

@peak3d I'm getting a crash when seeking in HEVC stream (most of the time, but sometimes the seek works as expected). Can you, please, have a look?

palinek commented 5 years ago

Now I've added some dirty debug messages and it really seems there is some problem with the stream_info.extra_data_size over/under-flow:

$ git diff
diff --git a/lib/mpegts/ES_hevc.cpp b/lib/mpegts/ES_hevc.cpp
index 47224bd..9ad6ec4 100644
--- a/lib/mpegts/ES_hevc.cpp
+++ b/lib/mpegts/ES_hevc.cpp
@@ -23,6 +23,7 @@
 #include "ES_hevc.h"
 #include "bitstream.h"
 #include "debug.h"
+#include <iostream>

 #include <cstring>      // for memset memcpy

@@ -180,6 +181,7 @@ void ES_hevc::Parse_HEVC(int buf_ptr, unsigned int NumBytesInNalUnit, bool &comp
     case NAL_VPS_NUT:
       if (m_NeedVPS)
       {
+std::cerr << __FILE__ << ':' <<__LINE__ << ' ' << static_cast<void*>(stream_info.extra_data) << ',' << stream_info.extra_data_size << ',' << static_cast<void*>(es_buf) << ',' << buf_ptr << ',' << NumBytesInNalUnit  << '\n';
         memcpy(stream_info.extra_data + stream_info.extra_data_size, es_buf + (buf_ptr - 4), NumBytesInNalUnit);
         stream_info.extra_data_size += NumBytesInNalUnit;
         m_NeedVPS = false;
@@ -197,6 +199,7 @@ void ES_hevc::Parse_HEVC(int buf_ptr, unsigned int NumBytesInNalUnit, bool &comp
       Parse_SPS(buf, NumBytesInNalUnit, hdr);
       if (m_NeedSPS)
       {
+std::cerr << __FILE__ << ':' <<__LINE__ << ' ' << static_cast<void*>(stream_info.extra_data) << ',' << stream_info.extra_data_size << ',' << static_cast<void*>(es_buf) << ',' << buf_ptr << ',' << NumBytesInNalUnit  << '\n';
         memcpy(stream_info.extra_data + stream_info.extra_data_size, es_buf + (buf_ptr - 4), NumBytesInNalUnit);
         stream_info.extra_data_size += NumBytesInNalUnit;
         m_NeedSPS = false;
@@ -215,6 +218,7 @@ void ES_hevc::Parse_HEVC(int buf_ptr, unsigned int NumBytesInNalUnit, bool &comp
       Parse_PPS(buf, NumBytesInNalUnit);
       if (m_NeedPPS)
       {
+std::cerr << __FILE__ << ':' <<__LINE__ << ' ' << static_cast<void*>(stream_info.extra_data) << ',' << stream_info.extra_data_size << ',' << static_cast<void*>(es_buf) << ',' << buf_ptr << ',' << NumBytesInNalUnit  << '\n';
         memcpy(stream_info.extra_data + stream_info.extra_data_size, es_buf + (buf_ptr - 4), NumBytesInNalUnit);
         stream_info.extra_data_size += NumBytesInNalUnit;
         m_NeedPPS = false;
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7fad2405dad9,0,0x7fad4cf5d010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7fad2405dad9,28,0x7fad4cf5d010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7fad2405dad9,78,0x7fad4cf5d010,82,11
sh: nmblookup: command not found
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7fad2405dad9,89,0x7fad4cf5d010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7fad2405dad9,117,0x7fad4cf5d010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7fad2405dad9,167,0x7fad4cf5d010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7fad2405dad9,178,0x7fad4cf5d010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7fad2405dad9,206,0x7fad4cf5d010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7fad2405dad9,256,0x7fad4cf5d010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7fad2405dad9,-1073658868,0x7fad4cf5d010,4,28
/home/palco/opt/kodi/bin/kodi: line 219:  6894 Segmentation fault      (core dumped) ${KODI_BINARY} $SAVED_ARGS
peak3d commented 5 years ago

@palinek interesting to get huge codec extradata for streams which should not have multiple SPS identifier.

pls increase the value here: https://github.com/peak3d/inputstream.adaptive/blob/master/lib/mpegts/elementaryStream.h#L76 to 4096, keep the log lines and let me know how much extra-data is required for your stream, thx!

palinek commented 5 years ago

It increases with each seek:

/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,0,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,28,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,78,0x7f9f00008010,82,11
sh: nmblookup: command not found
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,89,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,117,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,167,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,178,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,206,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,256,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,267,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,295,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,345,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,356,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,384,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,434,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,445,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,473,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,523,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,534,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,562,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,612,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,623,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,651,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,701,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,712,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,740,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,790,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,801,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,829,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,879,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,890,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,918,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,968,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,979,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,1007,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,1057,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,1068,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,1096,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,1146,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,1157,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,1185,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,1235,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,1246,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,1274,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,1324,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,1335,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,1363,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,1413,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,1424,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,1452,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,1502,0x7f9f00008010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7f9efc18ae69,1513,0x7f9f00008010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7f9efc18ae69,1541,0x7f9f00008010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7f9efc18ae69,1591,0x7f9f00008010,82,11

... the size is each time 28, 50 & 11 ... to me it seems there is some "reset" missing, not?

peak3d commented 5 years ago

yes, looks like that.

can you set extra_data_size = 0; pls here: https://github.com/peak3d/inputstream.adaptive/blob/master/lib/mpegts/elementaryStream.cpp#L68

palinek commented 5 years ago

can you set extra_data_size = 0; pls here: https://github.com/peak3d/inputstream.adaptive/blob/master/lib/mpegts/elementaryStream.cpp#L68

I've already tested this before (found some Reset()...), but with this change the stream does not start to play:

/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7fe274138089,0,0x7fe280267010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7fe274138089,28,0x7fe280267010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7fe274138089,78,0x7fe280267010,82,11
(next try to start playing)
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7fe2741a6e49,0,0x7fe2804f7010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7fe2741a6e49,28,0x7fe2804f7010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7fe2741a6e49,78,0x7fe2804f7010,82,11
(next try to start playing)
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:184 0x7fe2940cbc69,0,0x7fe2831b4010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:202 0x7fe2940cbc69,28,0x7fe2831b4010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:221 0x7fe2940cbc69,78,0x7fe2831b4010,82,11
peak3d commented 5 years ago

pls. provide a full debug log

palinek commented 5 years ago

Got it working... but I'm totally confused, if it's OK -> I moved the m_need*PS initialization only into constructor:

diff --git a/lib/mpegts/ES_hevc.cpp b/lib/mpegts/ES_hevc.cpp
index 47224bd..86c0380 100644
--- a/lib/mpegts/ES_hevc.cpp
+++ b/lib/mpegts/ES_hevc.cpp
@@ -40,6 +40,9 @@ ES_hevc::ES_hevc(uint16_t pes_pid)
   m_PTS               = PTS_UNSET;
   m_Interlaced        = false;
   es_alloc_init       = 240000;
+  m_NeedVPS = true;
+  m_NeedSPS = true;
+  m_NeedPPS = true;
   Reset();
 }

@@ -116,9 +119,6 @@ void ES_hevc::Reset()
   ElementaryStream::Reset();
   m_StartCode = 0xffffffff;
   m_LastStartPos = -1;
-  m_NeedVPS = true;
-  m_NeedSPS = true;
-  m_NeedPPS = true;
   memset(&m_streamData, 0, sizeof(m_streamData));
 }

pls. provide a full debug log

Log with your git master? Or with some changes I've made into the sources?

peak3d commented 5 years ago

I pushed a commit that prevents adding extra_data per seek

palinek commented 5 years ago

I pushed a commit that prevents adding extra_data per seek

Great! Just tested with the peak3d/inputstream.adaptive@f63bd0cc389a75e23cd7671682be805d04b06a15... and seeks are not segfaulting any more:

/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:187 0x7f0fe40ffbc9,0,0x7f0fec088010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:205 0x7f0fe40ffbc9,28,0x7f0fec088010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:224 0x7f0fe40ffbc9,78,0x7f0fec088010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:187 0x7f0fe40ffbc9,0,0x7f0fec088010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:205 0x7f0fe40ffbc9,28,0x7f0fec088010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:224 0x7f0fe40ffbc9,78,0x7f0fec088010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:187 0x7f0fe40ffbc9,0,0x7f0fec088010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:205 0x7f0fe40ffbc9,28,0x7f0fec088010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:224 0x7f0fe40ffbc9,78,0x7f0fec088010,82,11
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:187 0x7f0fe40ffbc9,0,0x7f0fec088010,4,28
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:205 0x7f0fe40ffbc9,28,0x7f0fec088010,32,50
/home/palco/work/oss/kodi/inputstream.adaptive/lib/mpegts/ES_hevc.cpp:224 0x7f0fe40ffbc9,78,0x7f0fec088010,82,11
...

Thank you.