Chromium Code Reviews

Side by Side Diff: media/test/pipeline_integration_test.cc

Issue 1318643005: Rename MockMediaSource.Abort into Shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed accidental test renaming Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 541 matching lines...)
552 &timestamp_offset, 552 &timestamp_offset,
553 base::Bind(&MockMediaSource::InitSegmentReceived, 553 base::Bind(&MockMediaSource::InitSegmentReceived,
554 base::Unretained(this))); 554 base::Unretained(this)));
555 last_timestamp_offset_ = timestamp_offset; 555 last_timestamp_offset_ = timestamp_offset;
556 } 556 }
557 557
558 void EndOfStream() { 558 void EndOfStream() {
559 chunk_demuxer_->MarkEndOfStream(PIPELINE_OK); 559 chunk_demuxer_->MarkEndOfStream(PIPELINE_OK);
560 } 560 }
561 561
562 void Abort() { 562 void Shutdown() {
563 if (!chunk_demuxer_) 563 if (!chunk_demuxer_)
564 return; 564 return;
565 chunk_demuxer_->Abort(
566 kSourceId,
567 base::TimeDelta(), kInfiniteDuration(), &last_timestamp_offset_);
565 chunk_demuxer_->Shutdown(); 568 chunk_demuxer_->Shutdown();
566 chunk_demuxer_ = NULL; 569 chunk_demuxer_ = NULL;
567 } 570 }
568 571
569 void DemuxerOpened() { 572 void DemuxerOpened() {
570 base::MessageLoop::current()->PostTask( 573 base::MessageLoop::current()->PostTask(
571 FROM_HERE, base::Bind(&MockMediaSource::DemuxerOpenedTask, 574 FROM_HERE, base::Bind(&MockMediaSource::DemuxerOpenedTask,
572 base::Unretained(this))); 575 base::Unretained(this)));
573 } 576 }
574 577
(...skipping 199 matching lines...)
774 Play(); 777 Play();
775 if (!WaitUntilCurrentTimeIsAfter(start_seek_time)) 778 if (!WaitUntilCurrentTimeIsAfter(start_seek_time))
776 return false; 779 return false;
777 780
778 source.Seek(seek_time, seek_file_position, seek_append_size); 781 source.Seek(seek_time, seek_file_position, seek_append_size);
779 if (!Seek(seek_time)) 782 if (!Seek(seek_time))
780 return false; 783 return false;
781 784
782 source.EndOfStream(); 785 source.EndOfStream();
783 786
784 source.Abort(); 787 source.Shutdown();
785 Stop(); 788 Stop();
786 return true; 789 return true;
787 } 790 }
788 }; 791 };
789 792
790 TEST_F(PipelineIntegrationTest, BasicPlayback) { 793 TEST_F(PipelineIntegrationTest, BasicPlayback) {
791 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); 794 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm"));
792 795
793 Play(); 796 Play();
794 797
(...skipping 149 matching lines...)
944 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 947 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
945 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 948 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
946 EXPECT_EQ(k320WebMFileDurationMs, 949 EXPECT_EQ(k320WebMFileDurationMs,
947 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 950 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
948 951
949 Play(); 952 Play();
950 953
951 ASSERT_TRUE(WaitUntilOnEnded()); 954 ASSERT_TRUE(WaitUntilOnEnded());
952 955
953 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null()); 956 EXPECT_TRUE(demuxer_->GetTimelineOffset().is_null());
954 source.Abort(); 957 source.Shutdown();
955 Stop(); 958 Stop();
956 } 959 }
957 960
958 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Live) { 961 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Live) {
959 MockMediaSource source("bear-320x240-live.webm", kWebM, 219221); 962 MockMediaSource source("bear-320x240-live.webm", kWebM, 219221);
960 StartPipelineWithMediaSource(&source); 963 StartPipelineWithMediaSource(&source);
961 source.EndOfStream(); 964 source.EndOfStream();
962 965
963 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 966 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
964 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 967 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
965 EXPECT_EQ(k320WebMFileDurationMs, 968 EXPECT_EQ(k320WebMFileDurationMs,
966 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 969 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
967 970
968 Play(); 971 Play();
969 972
970 ASSERT_TRUE(WaitUntilOnEnded()); 973 ASSERT_TRUE(WaitUntilOnEnded());
971 974
972 EXPECT_EQ(kLiveTimelineOffset(), 975 EXPECT_EQ(kLiveTimelineOffset(),
973 demuxer_->GetTimelineOffset()); 976 demuxer_->GetTimelineOffset());
974 source.Abort(); 977 source.Shutdown();
975 Stop(); 978 Stop();
976 } 979 }
977 980
978 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP9_WebM) { 981 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP9_WebM) {
979 MockMediaSource source("bear-vp9.webm", kWebMVP9, 67504); 982 MockMediaSource source("bear-vp9.webm", kWebMVP9, 67504);
980 StartPipelineWithMediaSource(&source); 983 StartPipelineWithMediaSource(&source);
981 source.EndOfStream(); 984 source.EndOfStream();
982 985
983 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 986 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
984 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 987 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
985 EXPECT_EQ(kVP9WebMFileDurationMs, 988 EXPECT_EQ(kVP9WebMFileDurationMs,
986 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 989 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
987 990
988 Play(); 991 Play();
989 992
990 ASSERT_TRUE(WaitUntilOnEnded()); 993 ASSERT_TRUE(WaitUntilOnEnded());
991 source.Abort(); 994 source.Shutdown();
992 Stop(); 995 Stop();
993 } 996 }
994 997
995 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP8A_WebM) { 998 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VP8A_WebM) {
996 MockMediaSource source("bear-vp8a.webm", kVideoOnlyWebM, kAppendWholeFile); 999 MockMediaSource source("bear-vp8a.webm", kVideoOnlyWebM, kAppendWholeFile);
997 StartPipelineWithMediaSource(&source); 1000 StartPipelineWithMediaSource(&source);
998 source.EndOfStream(); 1001 source.EndOfStream();
999 1002
1000 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1003 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1001 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1004 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1002 EXPECT_EQ(kVP8AWebMFileDurationMs, 1005 EXPECT_EQ(kVP8AWebMFileDurationMs,
1003 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1006 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1004 1007
1005 Play(); 1008 Play();
1006 1009
1007 ASSERT_TRUE(WaitUntilOnEnded()); 1010 ASSERT_TRUE(WaitUntilOnEnded());
1008 source.Abort(); 1011 source.Shutdown();
1009 Stop(); 1012 Stop();
1010 } 1013 }
1011 1014
1012 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) { 1015 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) {
1013 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, 1016 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM,
1014 kAppendWholeFile); 1017 kAppendWholeFile);
1015 StartPipelineWithMediaSource(&source); 1018 StartPipelineWithMediaSource(&source);
1016 source.EndOfStream(); 1019 source.EndOfStream();
1017 1020
1018 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1021 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1019 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1022 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1020 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, 1023 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs,
1021 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1024 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1022 Play(); 1025 Play();
1023 1026
1024 ASSERT_TRUE(WaitUntilOnEnded()); 1027 ASSERT_TRUE(WaitUntilOnEnded());
1025 source.Abort(); 1028 source.Shutdown();
1026 Stop(); 1029 Stop();
1027 } 1030 }
1028 1031
1029 // Flaky. http://crbug.com/304776 1032 // Flaky. http://crbug.com/304776
1030 TEST_F(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) { 1033 TEST_F(PipelineIntegrationTest, DISABLED_MediaSource_Opus_Seeking_WebM) {
1031 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM, 1034 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM,
1032 kAppendWholeFile); 1035 kAppendWholeFile);
1033 StartHashedPipelineWithMediaSource(&source); 1036 StartHashedPipelineWithMediaSource(&source);
1034 1037
1035 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1038 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1036 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1039 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1037 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs, 1040 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs,
1038 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1041 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1039 1042
1040 base::TimeDelta start_seek_time = base::TimeDelta::FromMilliseconds(1000); 1043 base::TimeDelta start_seek_time = base::TimeDelta::FromMilliseconds(1000);
1041 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000); 1044 base::TimeDelta seek_time = base::TimeDelta::FromMilliseconds(2000);
1042 1045
1043 Play(); 1046 Play();
1044 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time)); 1047 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(start_seek_time));
1045 source.Seek(seek_time, 0x1D5, 34017); 1048 source.Seek(seek_time, 0x1D5, 34017);
1046 source.EndOfStream(); 1049 source.EndOfStream();
1047 ASSERT_TRUE(Seek(seek_time)); 1050 ASSERT_TRUE(Seek(seek_time));
1048 1051
1049 ASSERT_TRUE(WaitUntilOnEnded()); 1052 ASSERT_TRUE(WaitUntilOnEnded());
1050 1053
1051 EXPECT_HASH_EQ("0.76,0.20,-0.82,-0.58,-1.29,-0.29,", GetAudioHash()); 1054 EXPECT_HASH_EQ("0.76,0.20,-0.82,-0.58,-1.29,-0.29,", GetAudioHash());
1052 1055
1053 source.Abort(); 1056 source.Shutdown();
1054 Stop(); 1057 Stop();
1055 } 1058 }
1056 1059
1057 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { 1060 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) {
1058 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, 1061 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM,
1059 kAppendWholeFile); 1062 kAppendWholeFile);
1060 StartPipelineWithMediaSource(&source); 1063 StartPipelineWithMediaSource(&source);
1061 1064
1062 scoped_refptr<DecoderBuffer> second_file = 1065 scoped_refptr<DecoderBuffer> second_file =
1063 ReadTestDataFile("bear-640x360.webm"); 1066 ReadTestDataFile("bear-640x360.webm");
1064 1067
1065 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1068 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1066 second_file->data(), second_file->data_size()); 1069 second_file->data(), second_file->data_size());
1067 1070
1068 source.EndOfStream(); 1071 source.EndOfStream();
1069 1072
1070 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1073 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1071 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1074 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1072 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, 1075 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs,
1073 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1076 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1074 1077
1075 Play(); 1078 Play();
1076 1079
1077 EXPECT_TRUE(WaitUntilOnEnded()); 1080 EXPECT_TRUE(WaitUntilOnEnded());
1078 source.Abort(); 1081 source.Shutdown();
1079 Stop(); 1082 Stop();
1080 } 1083 }
1081 1084
1082 #if !defined(DISABLE_EME_TESTS) 1085 #if !defined(DISABLE_EME_TESTS)
1083 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_Encrypted_WebM) { 1086 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_Encrypted_WebM) {
1084 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, 1087 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
1085 kAppendWholeFile); 1088 kAppendWholeFile);
1086 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1089 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1087 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1090 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1088 1091
1089 scoped_refptr<DecoderBuffer> second_file = 1092 scoped_refptr<DecoderBuffer> second_file =
1090 ReadTestDataFile("bear-640x360-av_enc-av.webm"); 1093 ReadTestDataFile("bear-640x360-av_enc-av.webm");
1091 1094
1092 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1095 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1093 second_file->data(), second_file->data_size()); 1096 second_file->data(), second_file->data_size());
1094 1097
1095 source.EndOfStream(); 1098 source.EndOfStream();
1096 1099
1097 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1100 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1098 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1101 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1099 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs, 1102 EXPECT_EQ(kAppendTimeMs + k640WebMFileDurationMs,
1100 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1103 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1101 1104
1102 Play(); 1105 Play();
1103 1106
1104 EXPECT_TRUE(WaitUntilOnEnded()); 1107 EXPECT_TRUE(WaitUntilOnEnded());
1105 source.Abort(); 1108 source.Shutdown();
1106 Stop(); 1109 Stop();
1107 } 1110 }
1108 1111
1109 // Config changes from encrypted to clear are not currently supported. 1112 // Config changes from encrypted to clear are not currently supported.
1110 TEST_F(PipelineIntegrationTest, 1113 TEST_F(PipelineIntegrationTest,
1111 MediaSource_ConfigChange_ClearThenEncrypted_WebM) { 1114 MediaSource_ConfigChange_ClearThenEncrypted_WebM) {
1112 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, 1115 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM,
1113 kAppendWholeFile); 1116 kAppendWholeFile);
1114 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1117 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1115 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1118 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
(...skipping 11 matching lines...)
1127 1130
1128 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1131 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1129 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1132 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1130 // The second video was not added, so its time has not been added. 1133 // The second video was not added, so its time has not been added.
1131 EXPECT_EQ(k320WebMFileDurationMs, 1134 EXPECT_EQ(k320WebMFileDurationMs,
1132 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1135 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1133 1136
1134 Play(); 1137 Play();
1135 1138
1136 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); 1139 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
1137 source.Abort(); 1140 source.Shutdown();
1138 } 1141 }
1139 1142
1140 // Config changes from clear to encrypted are not currently supported. 1143 // Config changes from clear to encrypted are not currently supported.
1141 TEST_F(PipelineIntegrationTest, 1144 TEST_F(PipelineIntegrationTest,
1142 MediaSource_ConfigChange_EncryptedThenClear_WebM) { 1145 MediaSource_ConfigChange_EncryptedThenClear_WebM) {
1143 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM, 1146 MockMediaSource source("bear-320x240-16x9-aspect-av_enc-av.webm", kWebM,
1144 kAppendWholeFile); 1147 kAppendWholeFile);
1145 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1148 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1146 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1149 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1147 1150
1148 scoped_refptr<DecoderBuffer> second_file = 1151 scoped_refptr<DecoderBuffer> second_file =
1149 ReadTestDataFile("bear-640x360.webm"); 1152 ReadTestDataFile("bear-640x360.webm");
1150 1153
1151 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1154 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1152 second_file->data(), second_file->data_size()); 1155 second_file->data(), second_file->data_size());
1153 1156
1154 source.EndOfStream(); 1157 source.EndOfStream();
1155 1158
1156 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1159 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1157 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1160 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1158 // The second video was not added, so its time has not been added. 1161 // The second video was not added, so its time has not been added.
1159 EXPECT_EQ(k320EncWebMFileDurationMs, 1162 EXPECT_EQ(k320EncWebMFileDurationMs,
1160 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1163 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1161 1164
1162 Play(); 1165 Play();
1163 1166
1164 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); 1167 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
1165 source.Abort(); 1168 source.Shutdown();
1166 } 1169 }
1167 #endif // !defined(DISABLE_EME_TESTS) 1170 #endif // !defined(DISABLE_EME_TESTS)
1168 1171
1169 #if defined(USE_PROPRIETARY_CODECS) 1172 #if defined(USE_PROPRIETARY_CODECS)
1170 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { 1173 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) {
1171 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile); 1174 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile);
1172 StartPipelineWithMediaSource(&source); 1175 StartPipelineWithMediaSource(&source);
1173 source.EndOfStream(); 1176 source.EndOfStream();
1174 1177
1175 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1178 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
(...skipping 119 matching lines...)
1295 source.EndOfStream(); 1298 source.EndOfStream();
1296 1299
1297 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1300 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1298 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1301 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1299 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, 1302 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs,
1300 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1303 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1301 1304
1302 Play(); 1305 Play();
1303 1306
1304 EXPECT_TRUE(WaitUntilOnEnded()); 1307 EXPECT_TRUE(WaitUntilOnEnded());
1305 source.Abort(); 1308 source.Shutdown();
1306 Stop(); 1309 Stop();
1307 } 1310 }
1308 1311
1309 #if !defined(DISABLE_EME_TESTS) 1312 #if !defined(DISABLE_EME_TESTS)
1310 TEST_F(PipelineIntegrationTest, 1313 TEST_F(PipelineIntegrationTest,
1311 MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly) { 1314 MediaSource_ConfigChange_Encrypted_MP4_CENC_VideoOnly) {
1312 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video, 1315 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video,
1313 kAppendWholeFile); 1316 kAppendWholeFile);
1314 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1317 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1315 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1318 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1316 1319
1317 scoped_refptr<DecoderBuffer> second_file = 1320 scoped_refptr<DecoderBuffer> second_file =
1318 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4"); 1321 ReadTestDataFile("bear-1280x720-v_frag-cenc.mp4");
1319 1322
1320 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1323 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1321 second_file->data(), second_file->data_size()); 1324 second_file->data(), second_file->data_size());
1322 1325
1323 source.EndOfStream(); 1326 source.EndOfStream();
1324 1327
1325 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1328 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1326 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1329 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1327 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, 1330 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs,
1328 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1331 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1329 1332
1330 Play(); 1333 Play();
1331 1334
1332 EXPECT_TRUE(WaitUntilOnEnded()); 1335 EXPECT_TRUE(WaitUntilOnEnded());
1333 source.Abort(); 1336 source.Shutdown();
1334 Stop(); 1337 Stop();
1335 } 1338 }
1336 1339
1337 TEST_F(PipelineIntegrationTest, 1340 TEST_F(PipelineIntegrationTest,
1338 MediaSource_ConfigChange_Encrypted_MP4_CENC_KeyRotation_VideoOnly) { 1341 MediaSource_ConfigChange_Encrypted_MP4_CENC_KeyRotation_VideoOnly) {
1339 MockMediaSource source("bear-640x360-v_frag-cenc-key_rotation.mp4", kMP4Video, 1342 MockMediaSource source("bear-640x360-v_frag-cenc-key_rotation.mp4", kMP4Video,
1340 kAppendWholeFile); 1343 kAppendWholeFile);
1341 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); 1344 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp());
1342 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1345 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1343 1346
1344 scoped_refptr<DecoderBuffer> second_file = 1347 scoped_refptr<DecoderBuffer> second_file =
1345 ReadTestDataFile("bear-1280x720-v_frag-cenc-key_rotation.mp4"); 1348 ReadTestDataFile("bear-1280x720-v_frag-cenc-key_rotation.mp4");
1346 1349
1347 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1350 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1348 second_file->data(), second_file->data_size()); 1351 second_file->data(), second_file->data_size());
1349 1352
1350 source.EndOfStream(); 1353 source.EndOfStream();
1351 1354
1352 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1355 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1353 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1356 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1354 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs, 1357 EXPECT_EQ(kAppendTimeMs + k1280IsoFileDurationMs,
1355 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1358 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1356 1359
1357 Play(); 1360 Play();
1358 1361
1359 EXPECT_TRUE(WaitUntilOnEnded()); 1362 EXPECT_TRUE(WaitUntilOnEnded());
1360 source.Abort(); 1363 source.Shutdown();
1361 Stop(); 1364 Stop();
1362 } 1365 }
1363 1366
1364 // Config changes from clear to encrypted are not currently supported. 1367 // Config changes from clear to encrypted are not currently supported.
1365 // TODO(ddorwin): Figure out why this CHECKs in AppendAtTime(). 1368 // TODO(ddorwin): Figure out why this CHECKs in AppendAtTime().
1366 TEST_F(PipelineIntegrationTest, 1369 TEST_F(PipelineIntegrationTest,
1367 DISABLED_MediaSource_ConfigChange_ClearThenEncrypted_MP4_CENC) { 1370 DISABLED_MediaSource_ConfigChange_ClearThenEncrypted_MP4_CENC) {
1368 MockMediaSource source("bear-640x360-av_frag.mp4", kMP4Video, 1371 MockMediaSource source("bear-640x360-av_frag.mp4", kMP4Video,
1369 kAppendWholeFile); 1372 kAppendWholeFile);
1370 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1373 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
(...skipping 12 matching lines...)
1383 1386
1384 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1387 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1385 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1388 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1386 // The second video was not added, so its time has not been added. 1389 // The second video was not added, so its time has not been added.
1387 EXPECT_EQ(k640IsoFileDurationMs, 1390 EXPECT_EQ(k640IsoFileDurationMs,
1388 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1391 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1389 1392
1390 Play(); 1393 Play();
1391 1394
1392 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); 1395 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
1393 source.Abort(); 1396 source.Shutdown();
1394 } 1397 }
1395 1398
1396 // Config changes from encrypted to clear are not currently supported. 1399 // Config changes from encrypted to clear are not currently supported.
1397 TEST_F(PipelineIntegrationTest, 1400 TEST_F(PipelineIntegrationTest,
1398 MediaSource_ConfigChange_EncryptedThenClear_MP4_CENC) { 1401 MediaSource_ConfigChange_EncryptedThenClear_MP4_CENC) {
1399 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video, 1402 MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video,
1400 kAppendWholeFile); 1403 kAppendWholeFile);
1401 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1404 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1402 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1405 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1403 1406
1404 scoped_refptr<DecoderBuffer> second_file = 1407 scoped_refptr<DecoderBuffer> second_file =
1405 ReadTestDataFile("bear-1280x720-av_frag.mp4"); 1408 ReadTestDataFile("bear-1280x720-av_frag.mp4");
1406 1409
1407 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 1410 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
1408 second_file->data(), second_file->data_size()); 1411 second_file->data(), second_file->data_size());
1409 1412
1410 source.EndOfStream(); 1413 source.EndOfStream();
1411 1414
1412 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1415 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1413 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1416 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1414 // The second video was not added, so its time has not been added. 1417 // The second video was not added, so its time has not been added.
1415 EXPECT_EQ(k640IsoCencFileDurationMs, 1418 EXPECT_EQ(k640IsoCencFileDurationMs,
1416 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1419 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1417 1420
1418 Play(); 1421 Play();
1419 1422
1420 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); 1423 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError());
1421 source.Abort(); 1424 source.Shutdown();
1422 } 1425 }
1423 #endif // !defined(DISABLE_EME_TESTS) 1426 #endif // !defined(DISABLE_EME_TESTS)
1424 1427
1425 // Verify files which change configuration midstream fail gracefully. 1428 // Verify files which change configuration midstream fail gracefully.
1426 TEST_F(PipelineIntegrationTest, MidStreamConfigChangesFail) { 1429 TEST_F(PipelineIntegrationTest, MidStreamConfigChangesFail) {
1427 ASSERT_EQ(PIPELINE_OK, Start("midstream_config_change.mp3")); 1430 ASSERT_EQ(PIPELINE_OK, Start("midstream_config_change.mp3"));
1428 Play(); 1431 Play();
1429 ASSERT_EQ(WaitUntilEndedOrError(), PIPELINE_ERROR_DECODE); 1432 ASSERT_EQ(WaitUntilEndedOrError(), PIPELINE_ERROR_DECODE);
1430 } 1433 }
1431 1434
(...skipping 10 matching lines...)
1442 MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816); 1445 MockMediaSource source("bear-320x240-av_enc-av.webm", kWebM, 219816);
1443 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1446 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1444 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1447 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1445 1448
1446 source.EndOfStream(); 1449 source.EndOfStream();
1447 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1450 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1448 1451
1449 Play(); 1452 Play();
1450 1453
1451 ASSERT_TRUE(WaitUntilOnEnded()); 1454 ASSERT_TRUE(WaitUntilOnEnded());
1452 source.Abort(); 1455 source.Shutdown();
1453 Stop(); 1456 Stop();
1454 } 1457 }
1455 1458
1456 TEST_F(PipelineIntegrationTest, EncryptedPlayback_ClearStart_WebM) { 1459 TEST_F(PipelineIntegrationTest, EncryptedPlayback_ClearStart_WebM) {
1457 MockMediaSource source("bear-320x240-av_enc-av_clear-1s.webm", kWebM, 1460 MockMediaSource source("bear-320x240-av_enc-av_clear-1s.webm", kWebM,
1458 kAppendWholeFile); 1461 kAppendWholeFile);
1459 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1462 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1460 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1463 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1461 1464
1462 source.EndOfStream(); 1465 source.EndOfStream();
1463 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1466 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1464 1467
1465 Play(); 1468 Play();
1466 1469
1467 ASSERT_TRUE(WaitUntilOnEnded()); 1470 ASSERT_TRUE(WaitUntilOnEnded());
1468 source.Abort(); 1471 source.Shutdown();
1469 Stop(); 1472 Stop();
1470 } 1473 }
1471 1474
1472 TEST_F(PipelineIntegrationTest, EncryptedPlayback_NoEncryptedFrames_WebM) { 1475 TEST_F(PipelineIntegrationTest, EncryptedPlayback_NoEncryptedFrames_WebM) {
1473 MockMediaSource source("bear-320x240-av_enc-av_clear-all.webm", kWebM, 1476 MockMediaSource source("bear-320x240-av_enc-av_clear-all.webm", kWebM,
1474 kAppendWholeFile); 1477 kAppendWholeFile);
1475 FakeEncryptedMedia encrypted_media(new NoResponseApp()); 1478 FakeEncryptedMedia encrypted_media(new NoResponseApp());
1476 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1479 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1477 1480
1478 source.EndOfStream(); 1481 source.EndOfStream();
1479 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1482 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1480 1483
1481 Play(); 1484 Play();
1482 1485
1483 ASSERT_TRUE(WaitUntilOnEnded()); 1486 ASSERT_TRUE(WaitUntilOnEnded());
1484 source.Abort(); 1487 source.Shutdown();
1485 Stop(); 1488 Stop();
1486 } 1489 }
1487 #endif // !defined(DISABLE_EME_TESTS) 1490 #endif // !defined(DISABLE_EME_TESTS)
1488 1491
1489 #if defined(USE_PROPRIETARY_CODECS) 1492 #if defined(USE_PROPRIETARY_CODECS)
1490 #if !defined(DISABLE_EME_TESTS) 1493 #if !defined(DISABLE_EME_TESTS)
1491 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_VideoOnly) { 1494 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_VideoOnly) {
1492 MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", kMP4Video, 1495 MockMediaSource source("bear-1280x720-v_frag-cenc.mp4", kMP4Video,
1493 kAppendWholeFile); 1496 kAppendWholeFile);
1494 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1497 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1495 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1498 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1496 1499
1497 source.EndOfStream(); 1500 source.EndOfStream();
1498 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1501 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1499 1502
1500 Play(); 1503 Play();
1501 1504
1502 ASSERT_TRUE(WaitUntilOnEnded()); 1505 ASSERT_TRUE(WaitUntilOnEnded());
1503 source.Abort(); 1506 source.Shutdown();
1504 Stop(); 1507 Stop();
1505 } 1508 }
1506 1509
1507 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_AudioOnly) { 1510 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_AudioOnly) {
1508 MockMediaSource source("bear-1280x720-a_frag-cenc.mp4", kMP4Audio, 1511 MockMediaSource source("bear-1280x720-a_frag-cenc.mp4", kMP4Audio,
1509 kAppendWholeFile); 1512 kAppendWholeFile);
1510 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); 1513 FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
1511 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1514 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1512 1515
1513 source.EndOfStream(); 1516 source.EndOfStream();
1514 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1517 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1515 1518
1516 Play(); 1519 Play();
1517 1520
1518 ASSERT_TRUE(WaitUntilOnEnded()); 1521 ASSERT_TRUE(WaitUntilOnEnded());
1519 source.Abort(); 1522 source.Shutdown();
1520 Stop(); 1523 Stop();
1521 } 1524 }
1522 1525
1523 TEST_F(PipelineIntegrationTest, 1526 TEST_F(PipelineIntegrationTest,
1524 EncryptedPlayback_NoEncryptedFrames_MP4_CENC_VideoOnly) { 1527 EncryptedPlayback_NoEncryptedFrames_MP4_CENC_VideoOnly) {
1525 MockMediaSource source("bear-1280x720-v_frag-cenc_clear-all.mp4", kMP4Video, 1528 MockMediaSource source("bear-1280x720-v_frag-cenc_clear-all.mp4", kMP4Video,
1526 kAppendWholeFile); 1529 kAppendWholeFile);
1527 FakeEncryptedMedia encrypted_media(new NoResponseApp()); 1530 FakeEncryptedMedia encrypted_media(new NoResponseApp());
1528 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1531 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1529 1532
1530 source.EndOfStream(); 1533 source.EndOfStream();
1531 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1534 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1532 1535
1533 Play(); 1536 Play();
1534 1537
1535 ASSERT_TRUE(WaitUntilOnEnded()); 1538 ASSERT_TRUE(WaitUntilOnEnded());
1536 source.Abort(); 1539 source.Shutdown();
1537 Stop(); 1540 Stop();
1538 } 1541 }
1539 1542
1540 TEST_F(PipelineIntegrationTest, 1543 TEST_F(PipelineIntegrationTest,
1541 EncryptedPlayback_NoEncryptedFrames_MP4_CENC_AudioOnly) { 1544 EncryptedPlayback_NoEncryptedFrames_MP4_CENC_AudioOnly) {
1542 MockMediaSource source("bear-1280x720-a_frag-cenc_clear-all.mp4", kMP4Audio, 1545 MockMediaSource source("bear-1280x720-a_frag-cenc_clear-all.mp4", kMP4Audio,
1543 kAppendWholeFile); 1546 kAppendWholeFile);
1544 FakeEncryptedMedia encrypted_media(new NoResponseApp()); 1547 FakeEncryptedMedia encrypted_media(new NoResponseApp());
1545 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1548 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1546 1549
1547 source.EndOfStream(); 1550 source.EndOfStream();
1548 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1551 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1549 1552
1550 Play(); 1553 Play();
1551 1554
1552 ASSERT_TRUE(WaitUntilOnEnded()); 1555 ASSERT_TRUE(WaitUntilOnEnded());
1553 source.Abort(); 1556 source.Shutdown();
1554 Stop(); 1557 Stop();
1555 } 1558 }
1556 1559
1557 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Video) { 1560 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Video) {
1558 MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4", 1561 MockMediaSource source("bear-1280x720-v_frag-cenc-key_rotation.mp4",
1559 kMP4Video, kAppendWholeFile); 1562 kMP4Video, kAppendWholeFile);
1560 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); 1563 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp());
1561 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1564 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1562 1565
1563 source.EndOfStream(); 1566 source.EndOfStream();
1564 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1567 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1565 1568
1566 Play(); 1569 Play();
1567 1570
1568 ASSERT_TRUE(WaitUntilOnEnded()); 1571 ASSERT_TRUE(WaitUntilOnEnded());
1569 source.Abort(); 1572 source.Shutdown();
1570 Stop(); 1573 Stop();
1571 } 1574 }
1572 1575
1573 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Audio) { 1576 TEST_F(PipelineIntegrationTest, EncryptedPlayback_MP4_CENC_KeyRotation_Audio) {
1574 MockMediaSource source("bear-1280x720-a_frag-cenc-key_rotation.mp4", 1577 MockMediaSource source("bear-1280x720-a_frag-cenc-key_rotation.mp4",
1575 kMP4Audio, kAppendWholeFile); 1578 kMP4Audio, kAppendWholeFile);
1576 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp()); 1579 FakeEncryptedMedia encrypted_media(new RotatingKeyProvidingApp());
1577 StartPipelineWithEncryptedMedia(&source, &encrypted_media); 1580 StartPipelineWithEncryptedMedia(&source, &encrypted_media);
1578 1581
1579 source.EndOfStream(); 1582 source.EndOfStream();
1580 ASSERT_EQ(PIPELINE_OK, pipeline_status_); 1583 ASSERT_EQ(PIPELINE_OK, pipeline_status_);
1581 1584
1582 Play(); 1585 Play();
1583 1586
1584 ASSERT_TRUE(WaitUntilOnEnded()); 1587 ASSERT_TRUE(WaitUntilOnEnded());
1585 source.Abort(); 1588 source.Shutdown();
1586 Stop(); 1589 Stop();
1587 } 1590 }
1588 #endif // !defined(DISABLE_EME_TESTS) 1591 #endif // !defined(DISABLE_EME_TESTS)
1589 1592
1590 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) { 1593 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) {
1591 MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3, 1594 MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3,
1592 kAppendWholeFile); 1595 kAppendWholeFile);
1593 StartPipelineWithMediaSource(&source); 1596 StartPipelineWithMediaSource(&source);
1594 source.EndOfStream(); 1597 source.EndOfStream();
1595 1598
1596 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); 1599 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
1597 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); 1600 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
1598 EXPECT_EQ(k1280IsoAVC3FileDurationMs, 1601 EXPECT_EQ(k1280IsoAVC3FileDurationMs,
1599 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 1602 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
1600 1603
1601 Play(); 1604 Play();
1602 1605
1603 ASSERT_TRUE(WaitUntilOnEnded()); 1606 ASSERT_TRUE(WaitUntilOnEnded());
1604 source.Abort(); 1607 source.Shutdown();
1605 Stop(); 1608 Stop();
1606 } 1609 }
1607 #endif // defined(USE_PROPRIETARY_CODECS) 1610 #endif // defined(USE_PROPRIETARY_CODECS)
1608 1611
1609 TEST_F(PipelineIntegrationTest, SeekWhilePaused) { 1612 TEST_F(PipelineIntegrationTest, SeekWhilePaused) {
1610 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm")); 1613 ASSERT_EQ(PIPELINE_OK, Start("bear-320x240.webm"));
1611 1614
1612 base::TimeDelta duration(pipeline_->GetMediaDuration()); 1615 base::TimeDelta duration(pipeline_->GetMediaDuration());
1613 base::TimeDelta start_seek_time(duration / 4); 1616 base::TimeDelta start_seek_time(duration / 4);
1614 base::TimeDelta seek_time(duration * 3 / 4); 1617 base::TimeDelta seek_time(duration * 3 / 4);
(...skipping 166 matching lines...)
1781 } 1784 }
1782 1785
1783 // Same as above but using MediaSource. 1786 // Same as above but using MediaSource.
1784 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus441kHz) { 1787 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus441kHz) {
1785 MockMediaSource source( 1788 MockMediaSource source(
1786 "sfx-opus-441.webm", kOpusAudioOnlyWebM, kAppendWholeFile); 1789 "sfx-opus-441.webm", kOpusAudioOnlyWebM, kAppendWholeFile);
1787 StartPipelineWithMediaSource(&source); 1790 StartPipelineWithMediaSource(&source);
1788 source.EndOfStream(); 1791 source.EndOfStream();
1789 Play(); 1792 Play();
1790 ASSERT_TRUE(WaitUntilOnEnded()); 1793 ASSERT_TRUE(WaitUntilOnEnded());
1791 source.Abort(); 1794 source.Shutdown();
1792 Stop(); 1795 Stop();
1793 EXPECT_EQ(48000, 1796 EXPECT_EQ(48000,
1794 demuxer_->GetStream(DemuxerStream::AUDIO) 1797 demuxer_->GetStream(DemuxerStream::AUDIO)
1795 ->audio_decoder_config() 1798 ->audio_decoder_config()
1796 .samples_per_second()); 1799 .samples_per_second());
1797 } 1800 }
1798 1801
1799 // Ensures audio-only playback with missing or negative timestamps works. Tests 1802 // Ensures audio-only playback with missing or negative timestamps works. Tests
1800 // the common live-streaming case for chained ogg. See http://crbug.com/396864. 1803 // the common live-streaming case for chained ogg. See http://crbug.com/396864.
1801 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) { 1804 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) {
(...skipping 34 matching lines...)
1836 1839
1837 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 1840 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
1838 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 1841 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
1839 Play(); 1842 Play();
1840 ASSERT_TRUE(WaitUntilOnEnded()); 1843 ASSERT_TRUE(WaitUntilOnEnded());
1841 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 1844 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
1842 demuxer_->GetStartTime()); 1845 demuxer_->GetStartTime());
1843 } 1846 }
1844 1847
1845 } // namespace media 1848 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine