[common][mse][fix tc issue] 31/135731/1
authormengli.zhang <mengli.zhang@samsung.com>
Mon, 26 Jun 2017 19:10:07 +0000 (15:10 -0400)
committermengli.zhang <mengli.zhang@samsung.com>
Mon, 26 Jun 2017 19:10:17 +0000 (15:10 -0400)
Change-Id: I9990a0c6078d7ec8a4a27119f8b0577191bcde1c
Signed-off-by: mengli.zhang <mengli.zhang@samsung.com>
common/tct-mse-w3c-tests/mse/MediaSource_AppendAudioOffset.html
common/tct-mse-w3c-tests/mse/MediaSource_IncrementalAudio.html
common/tct-mse-w3c-tests/mse/MediaSource_duration_audioBuffer.html
common/tct-mse-w3c-tests/mse/MediaSource_duration_videoBuffer.html
common/tct-mse-w3c-tests/mse/MediaSource_video_ChangeRate.html
common/tct-mse-w3c-tests/mse/MediaSource_video_duration.html
common/tct-mse-w3c-tests/mse/support/mse_common.js

index 353ed472abf164be306c6a502785b69d5d1c970a..ef05b3200cbcf1f0374ac54f7d10e1f4435a2aa9 100755 (executable)
@@ -16,6 +16,7 @@ limitations under the License.
 
 Authors:
         Yinghua Zhang<yingh.zhang@samsung.com>
+        Mengli Zhang<mengli.zhang@samsung.com>
 
 -->
 <html>
@@ -46,15 +47,17 @@ t.step(function() {
     onGetBufferArray = t.step_func(function(uint8Array) {
         audioSourceBuffer.timestampOffset = 5;
         audioSourceBuffer.appendBuffer(uint8Array);
-        audioSourceBuffer.abort();
-        audioSourceBuffer.timestampOffset = 0;
-        audioSourceBuffer.appendBuffer(uint8Array);
-               setTimeout(function(){
-                       assert_equals(audioSourceBuffer.buffered.length, 1, 'Source buffer number');
-                       assert_equals(audioSourceBuffer.buffered.start(0), 0, 'Range start');
-                       assert_approx_equals(audioSourceBuffer.buffered.end(0), 16.4, 'Range end');
-                       t.done();
-               },0);
+        audioSourceBuffer.addEventListener('update', function() {
+            audioSourceBuffer.abort();
+            audioSourceBuffer.timestampOffset = 0;
+            audioSourceBuffer.appendBuffer(uint8Array);
+            setTimeout(function(){
+                assert_equals(audioSourceBuffer.buffered.length, 1, 'Source buffer number');
+                assert_equals(audioSourceBuffer.buffered.start(0), 0, 'Range start');
+                assert_approx_equals(audioSourceBuffer.buffered.end(0), 17.42, 'Range end');
+                t.done();
+            },0);
+        });
     });
 
     sourceopenCallback =  t.step_func(function (event){
index 39305810f3d78236e1458676f872c0a6a97942b7..43533d5e31424707a66ce3b0dc07d5610d05659d 100755 (executable)
@@ -16,6 +16,7 @@ limitations under the License.
 
 Authors:
         Yinghua Zhang<yingh.zhang@samsung.com>
+        Mengli Zhang<mengli.zhang@samsung.com>
 
 -->
 <html>
@@ -44,7 +45,7 @@ sourceopenCallback, audioSourceBuffer, onGetBufferArray;
 
 t.step(function() {
     onTimeOut =  t.step_func(function (event){
-        assert_approx_equals(audioSourceBuffer.buffered.end(0), 8.15, 'Range end');
+        assert_approx_equals(audioSourceBuffer.buffered.end(0), 12.42, 'Range end');
         assert_equals(audioSourceBuffer.buffered.start(0), 0, 'Range start');
         assert_equals(audioSourceBuffer.buffered.length, 1, 'Source buffer number');
         t.done();
@@ -52,9 +53,11 @@ t.step(function() {
 
     onGetBufferArray = t.step_func(function(uint8Array) {
         audioSourceBuffer.appendBuffer(uint8Array);
-        audioSourceBuffer.abort();
-        setTimeout(onTimeOut, 0);
-        audioSourceBuffer.appendBuffer(uint8Array);
+        audioSourceBuffer.addEventListener('update', function() {
+            audioSourceBuffer.abort();
+            setTimeout(onTimeOut, 0);
+            audioSourceBuffer.appendBuffer(uint8Array);
+        });
     });
 
     sourceopenCallback =  t.step_func(function (event){
index 9b731007a043be02fe1d63c19fa18f71201e925c..d45c3f76c7423d0fb97dd57780ef3a0a06cf6061 100755 (executable)
@@ -16,6 +16,7 @@ limitations under the License.
 
 Authors:
         Jingbiao Nan<jingbiao.nan@samsung.com>
+        Mengli Zhang<mengli.zhang@samsung.com>
 
 -->
 <html>
@@ -40,7 +41,7 @@ Authors:
 setup({timeout: 180000});
 
 var t = async_test(document.title, {timeout: 180000}), mediaSource, video,
-sourceopenCallback, onDurationChanged, sourceBuffer, onGetBufferArray;
+sourceopenCallback, onDurationChanged, sourceBuffer, onGetBufferArray, updateCb;
 
 t.step(function() {
     onDurationChanged = t.step_func(function(uint8Array) {
@@ -49,8 +50,7 @@ t.step(function() {
         t.done();
     });
 
-    onGetBufferArray = t.step_func(function(uint8Array) {
-        sourceBuffer.appendBuffer(uint8Array);
+    updateCb = t.step_func(function(uint8Array) {
         setTimeout(function(){
             sourceBuffer.abort();
             video.addEventListener('durationchange', onDurationChanged);
@@ -58,8 +58,13 @@ t.step(function() {
         }, 0);
     });
 
+    onGetBufferArray = t.step_func(function(uint8Array) {
+        sourceBuffer.appendBuffer(uint8Array);
+    });
+
     sourceopenCallback =  t.step_func(function (event){
         sourceBuffer = mediaSource.addSourceBuffer(AUDIO_TYPE);
+        sourceBuffer.addEventListener('update', updateCb);
         GET_MEDIA(AUDIO_1_MB, onGetBufferArray);
     });
 
index 1a5b3d414840e39efc46df125b56e36fa7920397..fa22ae3a19506e01ed218b2587094e031eb5aad6 100755 (executable)
@@ -16,6 +16,7 @@ limitations under the License.
 
 Authors:
         Jingbiao Nan<jingbiao.nan@samsung.com>
+        Mengli Zhang<mengli.zhang@samsung.com>
 
 -->
 <html>
@@ -40,7 +41,7 @@ Authors:
 setup({timeout: 180000});
 
 var t = async_test(document.title, {timeout: 180000}), mediaSource, video,
-sourceopenCallback, onDurationChanged, sourceBuffer, onGetBufferArray;
+sourceopenCallback, onDurationChanged, sourceBuffer, onGetBufferArray, updateCb;
 
 t.step(function() {
     onDurationChanged = t.step_func(function(uint8Array) {
@@ -51,7 +52,9 @@ t.step(function() {
 
     onGetBufferArray = t.step_func(function(uint8Array) {
         sourceBuffer.appendBuffer(uint8Array);
+    });
 
+    updateCb = t.step_func(function(uint8Array) {
         setTimeout(function(){
             sourceBuffer.abort();
             video.addEventListener('durationchange', onDurationChanged);
@@ -61,6 +64,7 @@ t.step(function() {
 
     sourceopenCallback =  t.step_func(function (event){
         sourceBuffer = mediaSource.addSourceBuffer(VIDEO_TYPE);
+        sourceBuffer.addEventListener('update', updateCb);
         GET_MEDIA(VIDEO_TEST, onGetBufferArray);
     });
 
index 25ceeb2a33b6b557b520eee7ce8c52d49b2c15b0..b7dd3b612dcafbdc53aa4a674faacd51f8275cf9 100755 (executable)
@@ -16,6 +16,7 @@ limitations under the License.
 
 Authors:
         Yinghua Zhang<yingh.zhang@samsung.com>
+        Mengli Zhang<mengli.zhang@samsung.com>
 
 -->
 <html>
@@ -40,7 +41,7 @@ Authors:
 setup({timeout: 30000});
 
 var t = async_test(document.title, {timeout: 30000}), mediaSource, video, onMetadataLoad,
-sourceopenCallback, videoSourceBuffer, onGetVideoBufferArray, onTimeOut, onTimeupdate;
+sourceopenCallback, videoSourceBuffer, onGetVideoBufferArray, onTimeOut, onTimeupdate, updateCb;
 
 t.step(function() {
     onTimeupdate =  t.step_func(function (){
@@ -55,8 +56,7 @@ t.step(function() {
         video.play();
     });
 
-    onGetVideoBufferArray = t.step_func(function(uint8Array) {
-        videoSourceBuffer.appendBuffer(uint8Array);
+    updateCb = t.step_func(function(uint8Array) {
         setTimeout(t.step_func(function(){
             assert_equals(videoSourceBuffer.buffered.start(0), 0, 'Range start');
             assert_equals(videoSourceBuffer.buffered.length, 1, 'Source buffer number');
@@ -64,8 +64,13 @@ t.step(function() {
         }), 0);
     });
 
+    onGetVideoBufferArray = t.step_func(function(uint8Array) {
+        videoSourceBuffer.appendBuffer(uint8Array);
+    });
+
     sourceopenCallback =  t.step_func(function (event){
         videoSourceBuffer = mediaSource.addSourceBuffer(VIDEO_TYPE);
+        videoSourceBuffer.addEventListener('update', updateCb);
         GET_MEDIA(VIDEO_TEST, onGetVideoBufferArray);
     });
 
index 3a6180f89d3f8f19b6cb0c330ce95b371c13e92f..e08bdb955b1165a6079fe5fa983e585641cf4eac 100755 (executable)
@@ -45,20 +45,21 @@ sourceopenCallback, onGetBufferArray, sourceBuffer;
 t.step(function() {
     onGetBufferArray = t.step_func(function(uint8Array) {
         sourceBuffer.appendBuffer(uint8Array);
-        setTimeout(t.step_func(function(){
-            sourceBuffer.abort();
-            mediaSource.duration = 5;
-            assert_equals(mediaSource.duration, 5, "mediaSource duration should be 5.");
-            setTimeout(function(){
-                assert_equals(video.duration, 5, "video duration should be 5.");
-                t.done();
-            }, 0);
-        }), 0);
-        
     });
 
+    var updateCb = function() {
+        sourceBuffer.abort();
+        mediaSource.duration = 5;
+        assert_equals(mediaSource.duration, 5, "mediaSource duration should be 5.");
+        setTimeout(function(){
+            assert_equals(video.duration, 5, "video duration should be 5.");
+            t.done();
+        }, 0);
+    }
+
     sourceopenCallback =  t.step_func(function (event){
         sourceBuffer = mediaSource.addSourceBuffer(AUDIO_TYPE);
+        sourceBuffer.addEventListener('update', updateCb);
         GET_MEDIA(AUDIO_1_MB, onGetBufferArray);
     });
 
index f2ec4c73499cb5e833d5ecd93938ab27d47c4626..b434573d16a9ab3dc358da92f77e6f8331cd4c98 100755 (executable)
@@ -48,6 +48,7 @@ function GET_MEDIA(url, callback) {
   var xhr = new XMLHttpRequest();
   xhr.open('GET', url, true);
   xhr.responseType = 'arraybuffer';
+  xhr.setRequestHeader('Range', 'bytes=0-' + (200000 - 1));
   xhr.send();
 
   xhr.onload = function(e) {