Req "Demuxer" for separate streams - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93) +---- Forum: VideoPlayer Development (https://forum.kodi.tv/forumdisplay.php?fid=240) +---- Thread: Req "Demuxer" for separate streams (/showthread.php?tid=255626) |
RE: "Demuxer" for separate streams - FernetMenta - 2016-01-13 This is something you want to include in your environment: https://github.com/FernetMenta/xbmc/commit/814dcb9df6cb325ffb0262c270023438a81543b5 It drains decoder on stream change. Note than DXVA has not implemented this yet. RE: "Demuxer" for separate streams - peak3d - 2016-01-13 Thanx for your quick answers, I really appreciate it. I added the DTS/PTS values from m_Picture in VideoPlayerVideo:rocessDecoderOutput() directly after GetPicture() and as you said the PTS are ordered. But: I don't see the reason of: >CalcDropRequirement - dropped in decoder, Sleeptime: -19.212250, Bufferlevel: 2, Gain: 0.043417 and (most important) > CalcDropRequirement - dropped in decoder, Sleeptime: 0.137959, Bufferlevel: 2, Gain: 0.043417 (this leads to the freeze) I have still the feeling that there is some other (simpler) reason for the freeze than the lack of unbuffered decoder output. Code: 8:15:31:0482 T:10364 DEBUG: CVideoPlayerVideo::Flipping: 19978291.333333 Edit: I think it was because I have resetted the pullupCorrection in OpenStream() when stream changes - I disabled this and now it looks much better. Edit2: The CalcDropRequirement messages are gone but the freeze is still present :-( RE: "Demuxer" for separate streams - FernetMenta - 2016-01-13 as already mentioned a couple of times. you won't get the last frames out of dxva decoder unless to implement drain for it. what you are currently doing is to kill a couple of frames with destruction of dxva decoder. RE: "Demuxer" for separate streams - peak3d - 2016-01-13 I still don't see any problem on decoder side: Refering to the log above there is only one frame lost between old and new stream: Last old frame: Flipping: 19978291.333333 First new frame : GetPicture 20061708.333333 - 20061708.000000 Afterwards the decoder puts out all new frames on time, but then the 5-th decoded image of the new frame waits 0.14 secs to be inserted into the Renderer. 08:15:31:0625 T:10364 DEBUG: CVideoPlayerVideo::GetPicture 20311958.333333 - 20311958.000000 08:15:31:0763 T:10364 DEBUG: CVideoPlayerVideo::Flipping: 20311958.000000 But somehow I have the feeling that I haven't understood something basic on this topic, really sorry for annoying you! RE: "Demuxer" for separate streams - FernetMenta - 2016-01-13 (2016-01-13, 10:29)peak3d Wrote: I still don't see any problem on decoder side: Refering to the log above there is only one frame lost between old and new stream: If you ignore the little things, you'll never get it right. Why don't you try with dxva disabled? RE: "Demuxer" for separate streams - peak3d - 2016-01-13 DXVA is not used on Render side as all - it is Pixel-Shader (CopyFromDXVA is used in Renderer). I use DXVA for decoding because it seems to works fine. Disabling DXVA Decoder (no DXVA anymore at all) leads to the same problem, only with a longer freeze: 10:41:47:0765 T:3080 DEBUG: CVideoPlayerVideo::GetPicture 20603916.666667 - 20228541.000000 10:41:47:0999 T:3080 DEBUG: CVideoPlayerVideo::Flipping: 20228541.000000 RE: "Demuxer" for separate streams - FernetMenta - 2016-01-13 I was always referring to DXVA _decoder_. Believe it or not, it is not able to drain. Did you apply my patch for draining on stream change? Further DXVA in combination with pixel shaders is a bad idea because copying from dxva surface to the buffers used by pixel shaders does not perform well. RE: "Demuxer" for separate streams - FernetMenta - 2016-01-13 here is another one you want to add: https://github.com/FernetMenta/xbmc/commit/9428f0d46c266abb936a99800a5fdadbed59e3d3 RE: "Demuxer" for separate streams - FernetMenta - 2016-01-13 next you need to request the render thread for an extra cycle doing Configure without calling Flip on gfx context. be aware that the render thread waits in FrameWait. it needs to break the waiting and do the configure. RE: "Demuxer" for separate streams - peak3d - 2016-01-13 sorry, just yet read, I finally got the place of the gap: its: void CRenderManager::WaitPresentTime(double presenttime) ..... if(fps <= 0) { /* smooth video not enabled */ CDVDClock::WaitAbsoluteClock(presenttime * DVD_TIME_BASE); return; } Edit: This is the main thread and it sleeps for 496 msecs currently . If it is not interrupted (I'll look for it), then the render buffers will not be freed..... Edit2: Now I see what you mean why draining is necessary - tooks long, I know..... I'll look now at the hints you gave above..... RE: "Demuxer" for separate streams - peak3d - 2016-01-13 I applied both patches, 2 frames were drained and the freeze is shorter now. Thanks for this! There is still a gap of decoded PTS times between the two parts, but I think this comes from the data I pass. I'll check this now and maybe add some data to one of the parts to get the gap closed. RE: "Demuxer" for separate streams - peak3d - 2016-01-13 Do you know what: DXVA on my system drains more frames then FFMPEG decoder. With DXVA I'm coming to the decoded PTS wich fits to the second part! There is also a difference in the initial sequence of the second part: FFmpeg needs 6 packets before the first frame is available, DXVA only 2. Edit: To be more precise: DXVA drains 1 frame, ffmpeg 2 frames. But DXVA produces 4 more frames at the end of the first stream part. RE: "Demuxer" for separate streams - peak3d - 2016-01-13 I'll cleanup my code now and try a PR afterwards. How should we continue with the other (initial issue), that ffmepg doesn't pass the DXVA format in GetFormat()? You may remember, that I had an extra call to Decode to properly setup the (DXVA) decoder on time the stream change is read. a.) Put it into VideoPlayerVideo b.) Try to find the place in ffmpeg c.) RE: "Demuxer" for separate streams - peak3d - 2016-01-14 - I removed the initial decode call to avoid unnecessary discussions - I placed a DRAIN message into the message_queue instead applying your patch to avoid same code redundancies The commit confused the complete discussion we had before :-( PR is: https://github.com/xbmc/xbmc/pull/8830 Thanx again for your support! RE: "Demuxer" for separate streams - FernetMenta - 2016-01-14 (2016-01-13, 16:13)peak3d Wrote: There is also a difference in the initial sequence of the second part: If this is the case, something goes wrong. dxva hw accelerator is fed by mmpeg and it's ffmpeg parser to decide when a frame is complete. dxva only does the actual decoding of an entire frame. |