What does this actually indicate? CoreMediaErrorDomain" "Internal error: restarting too far ahead

During the course of stream a live HTTP Video Stream intermittently these errors show up in the logs for AVPlayer. What problem are they indicating for AVPlayer and what conditioning of the media stream is needed to resolve these errors?


2015/06/16 01:16:35.035 http://127.0.0.1:49815/f1434502503.ts 6376DBAA-A074-4F6A-B240-5CD1A838CE88 127.0.0.1 -12645 "CoreMediaErrorDomain" "Internal error: restarting too far ahead (-1.3884s)" lan

2015/06/16 01:17:14.014 http://127.0.0.1:49815/f1434502617.ts 6376DBAA-A074-4F6A-B240-5CD1A838CE88 127.0.0.1 -12645 "CoreMediaErrorDomain" "Internal error: restarting too far ahead (-1.9554s)" lan

2015/06/16 02:01:23.023 http://127.0.0.1:49815/f1434510588.ts 6376DBAA-A074-4F6A-B240-5CD1A838CE88 127.0.0.1 -12645 "CoreMediaErrorDomain" "Internal error: restarting too far ahead (-1.1115s)" lan

2015/06/16 02:01:31.031 http://127.0.0.1:49815/f1434510612.ts 6376DBAA-A074-4F6A-B240-5CD1A838CE88 - -12645 "CoreMediaErrorDomain" "Internal error: restarting too far ahead (-1.4285s)" lan

2015/06/16 02:47:36.036 http://127.0.0.1:49815/f1434518949.ts 6376DBAA-A074-4F6A-B240-5CD1A838CE88 127.0.0.1 -12645 "CoreMediaErrorDomain" "Internal error: restarting too far ahead (-1.5811s)" lan

2015/06/16 02:55:34.034 http://127.0.0.1:49815/f1434520383.ts 6376DBAA-A074-4F6A-B240-5CD1A838CE88 127.0.0.1 -12645 "CoreMediaErrorDomain" "Internal error: restarting too far ahead (-1.7908s)" lan

2015/06/16 03:10:49.049 http://127.0.0.1:49815/f1434523140.ts 6376DBAA-A074-4F6A-B240-5CD1A838CE88 127.0.0.1 -12645 "CoreMediaErrorDomain" "Internal error: restarting too far ahead (-1.7415s)" lan

2015/06/16 03:41:46.046 http://127.0.0.1:49815/f1434528732.ts 6376DBAA-A074-4F6A-B240-5CD1A838CE88 127.0.0.1 -12645 "CoreMediaErrorDomain" "Internal error: restarting too far ahead (-1.5722s)" lan

2015/06/16 07:13:08.008 http://127.0.0.1:49815/f1434566955.ts 6376DBAA-A074-4F6A-B240-5CD1A838CE88 127.0.0.1 -12645 "CoreMediaErrorDomain" "Internal error: restarting too far ahead (-1.2835s)" lan

2015/06/16 07:13:10.010 http://127.0.0.1:49815/f1434566964.ts 6376DBAA-A074-4F6A-B240-5CD1A838CE88 127.0.0.1 -12645 "CoreMediaErrorDomain" "Internal error: restarting too far ahead (-1.1441s)" lan

2

Replies

this is a critical problem and the Apple engineers at WWDC said to post the question here. When will the moderator decide to review this and post it or provide a private reply from Apple to address the problem?

You should file a bug report.

I could, except that this error appears on 100's of video sources across multiple releases of iOS. It is a specific error message that AVPlayer is adding to the log as a result of a decoding event in the HLS stream. So this isn't a bug, is a designed response to a specific condition in the segmented media stream.


The question is one that Apple should be able to describe what would trigger the log entry. Is this a mismatch between the audio and video frames PTS values in the current or active media segments? Is this a media segment to media segment PTS problem and the renderer in AVPlayer can't align the video and/or audio frames? Or is this from another structural problem in the segmented stream.


Without being able to describe what is right or wrong in the media stream in response to what Apple intends with this error message, I can't tell them what their bug is - it may be that all these media streams have some fundamental segmentation error.


I may have to file a bug to get their attention, I just find it poor support for Apple to not document such log entries or respond directly here with the facts of what they are trying to report.

Did you ever find out what the cause of the Internal Error was and the fix?


We're getting the same error and wondered if you had some guidance.

I'm sorry you were directed to ask your question here. That was not good advice. As we say in the intro to the forums "If there is a problem with Apple software or documentation, please file a bug report."


Engineers do not always look at the forums. They are not required to do so.


Creating a bug report gives us a trackable entity. You can ask developer technical support about it. Developer technical support is there to help you get answers when no one seems to know the answer.

According to an Apple employee this error message means that:


The player is complaining that it was trying to restart a live stream, but only had 1.4 seconds of material available.

How many segments are in your live playlist?

These days we recommend that you always have at least six segments in the playlist.

I believe the only effect is to delay palyback until it has enough data.


Source: https://forums.developer.apple.com/thread/40791

Sad thing is the number of media segments in the playlist make no difference to the occurrence of this error. I have tested from 3 to 40 items, still get this irregularly.

I have had the video streams analyzed for PTS/DTS and found no discontinuities or integrity problems with the timing of the stream.

I have not been able to correlate this to a specific bitrate (high or low) since I see this on 3Mbps streams and 64kbps streams.

I have not been able to correlate this to download timing, since I have seen this on segments that download in 10ms and 3s.

I have seen this in streams where every media segment is reported, up to 3 times each, and I have perfect streams, all with the same source video, network, device, and OS.

I have also been seeing this since iOS 6 when I first started working with this technology and it is still present in iOS 10.3 beta 1.

I have seen this when AVPlayer reports a seekable range of 2s and when it reports 40s. I strongly suspect that the volume of data is completely unrelated to the declaration of this error.

So my question still remains, what is the underlying flaw in the media stream that causes this error to occur?

I took a closer look at where this error is generated.

What it is saying is: "at this moment my playhead in this live stream is less than 2*target_duration from the end of the current playlist"

A live playlist is supposed to start 3*target_duration from the end.


Possibilities:

(1) The stream doesn't have enough segments in it. Obviously, not in your case since you checked that.

(2) The pattern of updates to the live playlist has resulted in a lag. Imagine the client has just missed an update and before it gets the next update it has rolled into the 2*target_duration range.


I would suggest adding an EXT-X-START tag. Give it a TIME-OFFSET equal to 3*target_duration. If the error still occurs, then it seems like we are in case (2). Then you can either figure out what is causing the lag, or try bumping the time offset by a bit. If you have to increase by a lot, then you have to fix the lag problem.


EXT-X-START was introduced in HLS version 6, so it should be honored by any device running iOS 7 or later (and Apple TV version 6 or later). It does not require an EXT-X-VERSION tag since it is backward compatible (ignored).


If the error goes away with a time offset of 3*target_duration then there may be a bug on our side. In that case file a radar and give us a live stream we can check. (Give us two master playlists, one with EXT-X-START and one without that uses the exact same media playlists.) Let us know about how long we have to play the stream for the error to occur,

To anyone that is still having this issue. I found through troubleshooting that the encoder was producing HLS manifests that contained tags that included negative ElapsedTimes, and that's what was causing iOS and Safari players to fail to play the content.