shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.06k stars 1.33k forks source link

shaka get stuck each ~10 sec in case of throttling - Edge #705

Closed yairans closed 7 years ago

yairans commented 7 years ago

http://v2-0-4.shaka-player-demo.appspot.com/demo/?asset=http://cdnapi.kaltura.com/p/1804331/sp/180433100/playManifest/entryId/1_1h4m0b66/format/mpegdash/protocol/http/uiConfId/35530811/a.mpd;license=https://udrmv3.kaltura.com//cenc/playready/license?custom_data=eyJjYV9zeXN0ZW0iOiJPVlAiLCJ1c2VyX3Rva2VuIjoiZGpKOE1UZ3dORE16TVh4WWNCNmpBSTZFZXhZNGNqSExqYTd5Ty1NWW84M0lDZHNDT3l5ZW02UDU4ZnhZUWRGN2E5dUlRNHIwekY3eF9ISzdtczNPS0VCV2NzTWU5VW1KM1VmTG5CenNnWmpuR3NNSzhIN0x0X01KNHc9PSIsImFjY291bnRfaWQiOiIxODA0MzMxIiwiY29udGVudF9pZCI6IjFfMWg0bTBiNjYiLCJmaWxlcyI6IjFfamJiOGpsOWwsMV8wOG0zOWhreSwxX21yamdpMmxyLDFfYm55eWh1anIifQ%3D%3D&signature=AWA9Hl9Q%2F%2BKZJSMF1YsxFEDGLkc%3D&;v

throttle the bandwidth to 750 kbps using Charles 4.0.2 Throttling file attached Throttling.txt change to .xml

shaka should select the appropriate track (exists) and play smootly

console and network logs attached

console.txt net-p1.txt change to .chls net-p2.txt change to .chls

TheModMaker commented 7 years ago

We don't cancel network requests that are in progress. So when you throttle the network down, we will request the current quality and it will take a long time to download. Once that segment is done, we'll detect the slower network and choose a lower bandwidth stream. Unfortunately, since we don't have a way to cancel, we have to wait until we get the response back to adapt.

TheModMaker commented 7 years ago

Your link doesn't work. To confirm, your issue is that when you throttle there is a slight delay before we choose the lower stream, right?

yairans commented 7 years ago

@TheModMaker No. My issue is after shaka chooses the lower stream. Please try this link http://v2-0-4.shaka-player-demo.appspot.com/demo/?asset=http://cdnapi.kaltura.com/p/1804331/sp/180433100/playManifest/entryId/1_1h4m0b66/format/mpegdash/protocol/http/uiConfId/35530811/a.mpd;license=https://udrmv3.kaltura.com//cenc/playready/license?custom_data=eyJjYV9zeXN0ZW0iOiJPVlAiLCJ1c2VyX3Rva2VuIjoiZGpKOE1UZ3dORE16TVh6T0dZeGVtRHlEaDJRRHFyX3JaZW56NHZkQ3lYLXliYmFaYzM3OU1WMTVqeHl0d0dqcDhuQTlTaDNucVY2TkhkQVgxaWdEN3UwaDFvaWhpZU9PTW8wZzZCYjBPUlBUSGhqZ1NKRkdLLXU2UHc9PSIsImFjY291bnRfaWQiOiIxODA0MzMxIiwiY29udGVudF9pZCI6IjFfMWg0bTBiNjYiLCJmaWxlcyI6IjFfamJiOGpsOWwsMV8wOG0zOWhreSwxX21yamdpMmxyLDFfYm55eWh1anIifQ%3D%3D&signature=WnAiZlULY1wA9jxQTGFksUbDu6c%3D&;v

Thanks, Yair

TheModMaker commented 7 years ago

@yairans That link doesn't work either. For both links I am getting 404 errors from the manifest.

I am confused by your description of the problem. Can you please describe exactly what the Charles program is doing, what the browser appears to do, and what the player does wrong. Thanks.

yairans commented 7 years ago

@TheModMaker please try this link on Edge http://v2-0-4.shaka-player-demo.appspot.com/demo/?asset=http://klive-a.akamaihd.net/dc-1/live/edash/p/1956791/e/0_8obdkkp6/sd/10000/t/ucOgGly-AkgGpCElsA0HKw/manifest.mpd;license=https://udrmv3.kaltura.com//cenc/playready/license?custom_data=eyJjYV9zeXN0ZW0iOiJPVlAiLCJ1c2VyX3Rva2VuIjoiWlRGaE1EVmtNRGxoTVRGak0yTXhaR0ZpT1dWaU9UUmpZbVF5WldVeVlqWXdZekE1WldZNFpId3hPVFUyTnpreE96RTVOVFkzT1RFN01qUTRPRGs0TlRVNE1qc3dPekUwT0RnNU9EVTFPRE11TnpZNU16dGhaRzFwYmp0MmFXVjNPaW9zZDJsa1oyVjBPakU3T3c9PSIsImFjY291bnRfaWQiOiIxOTU2NzkxIiwiY29udGVudF9pZCI6IjBfOG9iZGtrcDYiLCJmaWxlcyI6IjBfbTJrdXFkdzMsMF9sOGxlMHJpbiwwX2ljeXE5b216LDBfbnQ4N29hOW0sMF9jazZvdGtoayJ9&signature=7YnlmEmz7IRKFyHMzAykNDdzi%2FE%3D;v

Charles just simulates a low bandwidth (750kbps in my case). In case of low bandwidth shaka should select and switch to the appropriate video track. Indeed, shaka does it (after a min but it's ok as you comment above). But after shaka selects the lower video track the playback get stuck in each ~10 sec for ~2 sec.
I hope it's clear now.

Yair

TheModMaker commented 7 years ago

I think there are two kinds of stalling that can happen here:

First, if it is stalling before switching tracks. This can happen because it takes us a few segments to determine the bandwidth has changed. It will stall after every segment while it downloads high-bandwidth tracks until it determines the bandwidth changed.

Second, if it is stalling after switching tracks. This can happen if the bandwidth in the manifest doesn't match the bandwidth required to download the stream or if our estimate is slightly wrong. What I think is happening is that your buffer times are not ideal.

Your minBufferTime is the same as the segment size. This means that we will only download one segment ahead of the playhead. Also, if the estimated bandwidth is the same as the stream's bandwidth, it will take as long to download the segment as to play it. Meaning we will run out of buffer right before we download the segment.

I would suggest that you decrease the segment sizes. This will allow us to detect the bandwidth changes sooner and will increase the size of the buffer (in number of segments). This will also make it easier to play at the live edge. Alternatively you could increase the minBufferTime in the manifest or the bufferingGoal configuration in the Player.

yairans commented 7 years ago

@TheModMaker I increased the bufferingGoal in the player configuration to 30 (the default is 10). Nothing has changed. I still experience the same wrong behavior. Thanks, Yair

OrenMe commented 7 years ago

@TheModMaker any news on this? do you need more info?

TheModMaker commented 7 years ago

If you are changing the bufferingGoal in the demo, you need to change it after you start playback. Otherwise the demo will reset the value when you click Load.

What's probably happening is it is taking slightly longer (or exactly the same time) to download a segment than to play it. So we hit the end of the buffer before we finish downloading the next segment.

Unfortunately, it is already playing the lowest bandwidth stream, so there is nothing we can do. The bandwidth fields in the manifest are probably slightly wrong, but since there is no lower quality stream, increasing the fields wouldn't do anything.

joeyparrish commented 7 years ago

@yairans, can you retry with the latest code from master?

joeyparrish commented 7 years ago

Since there has been no reply in over 4 weeks, I'm closing this issue. @yairans, we can reopen at any time if you still need help with this.