Bug 972826 - reset 'src' to force releasing h264 decoder so that the cloned <video> can play gizmo.mp4. r=cajbir

This commit is contained in:
JW Wang 2014-07-17 20:28:00 +02:00
Родитель 7204779df4
Коммит 1c4c76cc54
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -23,7 +23,7 @@ function cloneLoaded(event) {
} }
e.removeEventListener("loadeddata", cloneLoaded, false); e.removeEventListener("loadeddata", cloneLoaded, false);
removeNodeAndSource(e);
manager.finished(e.token); manager.finished(e.token);
} }
@ -39,6 +39,17 @@ function tryClone(event) {
} }
clone.addEventListener("loadeddata", cloneLoaded, false); clone.addEventListener("loadeddata", cloneLoaded, false);
clone.onloadstart = function(evt) {
info("cloned " + evt.target.token + " start loading.");
evt.target.onloadstart = null;
// Since there is only one H264 decoder instance, we have to delete the
// decoder of the original element for the cloned element to load. However,
// we can't delete the decoder too early otherwise cloning decoder will
// fail to kick in. We wait for 'loadstart' event of the cloned element to
// know when the decoder is already cloned and we can delete the decoder of
// the original element.
removeNodeAndSource(e);
}
e.removeEventListener("loadeddata", tryClone, false); e.removeEventListener("loadeddata", tryClone, false);
} }