| OLD | NEW |
| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 using ::testing::SetArgumentPointee; | 30 using ::testing::SetArgumentPointee; |
| 31 using ::testing::_; | 31 using ::testing::_; |
| 32 | 32 |
| 33 namespace media { | 33 namespace media { |
| 34 | 34 |
| 35 const uint8 kTracksHeader[] = { | 35 const uint8 kTracksHeader[] = { |
| 36 0x16, 0x54, 0xAE, 0x6B, // Tracks ID | 36 0x16, 0x54, 0xAE, 0x6B, // Tracks ID |
| 37 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // tracks(size = 0) | 37 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // tracks(size = 0) |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 // WebM Block bytes that represent a VP8 keyframe. | 40 // WebM Block bytes that represent a VP8 key frame. |
| 41 const uint8 kVP8Keyframe[] = { | 41 const uint8 kVP8Keyframe[] = { |
| 42 0x010, 0x00, 0x00, 0x9d, 0x01, 0x2a, 0x00, 0x10, 0x00, 0x10, 0x00 | 42 0x010, 0x00, 0x00, 0x9d, 0x01, 0x2a, 0x00, 0x10, 0x00, 0x10, 0x00 |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // WebM Block bytes that represent a VP8 interframe. | 45 // WebM Block bytes that represent a VP8 interframe. |
| 46 const uint8 kVP8Interframe[] = { 0x11, 0x00, 0x00 }; | 46 const uint8 kVP8Interframe[] = { 0x11, 0x00, 0x00 }; |
| 47 | 47 |
| 48 static const uint8 kCuesHeader[] = { | 48 static const uint8 kCuesHeader[] = { |
| 49 0x1C, 0x53, 0xBB, 0x6B, // Cues ID | 49 0x1C, 0x53, 0xBB, 0x6B, // Cues ID |
| 50 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cues(size = 0) | 50 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // cues(size = 0) |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 | 422 |
| 423 bool operator< (const BlockInfo& rhs) const { | 423 bool operator< (const BlockInfo& rhs) const { |
| 424 return timestamp_in_ms < rhs.timestamp_in_ms; | 424 return timestamp_in_ms < rhs.timestamp_in_ms; |
| 425 } | 425 } |
| 426 }; | 426 }; |
| 427 | 427 |
| 428 // |track_number| - The track number to place in | 428 // |track_number| - The track number to place in |
| 429 // |block_descriptions| - A space delimited string of block info that | 429 // |block_descriptions| - A space delimited string of block info that |
| 430 // is used to populate |blocks|. Each block info has a timestamp in | 430 // is used to populate |blocks|. Each block info has a timestamp in |
| 431 // milliseconds and optionally followed by a 'K' to indicate that a block | 431 // milliseconds and optionally followed by a 'K' to indicate that a block |
| 432 // should be marked as a keyframe. For example "0K 30 60" should populate | 432 // should be marked as a key frame. For example "0K 30 60" should populate |
| 433 // |blocks| with 3 BlockInfo objects: a keyframe with timestamp 0 and 2 | 433 // |blocks| with 3 BlockInfo objects: a key frame with timestamp 0 and 2 |
| 434 // non-keyframes at 30ms and 60ms. | 434 // non-key-frames at 30ms and 60ms. |
| 435 void ParseBlockDescriptions(int track_number, | 435 void ParseBlockDescriptions(int track_number, |
| 436 const std::string block_descriptions, | 436 const std::string block_descriptions, |
| 437 std::vector<BlockInfo>* blocks) { | 437 std::vector<BlockInfo>* blocks) { |
| 438 std::vector<std::string> timestamps; | 438 std::vector<std::string> timestamps; |
| 439 base::SplitString(block_descriptions, ' ', ×tamps); | 439 base::SplitString(block_descriptions, ' ', ×tamps); |
| 440 | 440 |
| 441 for (size_t i = 0; i < timestamps.size(); ++i) { | 441 for (size_t i = 0; i < timestamps.size(); ++i) { |
| 442 std::string timestamp_str = timestamps[i]; | 442 std::string timestamp_str = timestamps[i]; |
| 443 BlockInfo block_info; | 443 BlockInfo block_info; |
| 444 block_info.track_number = track_number; | 444 block_info.track_number = track_number; |
| 445 block_info.flags = 0; | 445 block_info.flags = 0; |
| 446 block_info.duration = 0; | 446 block_info.duration = 0; |
| 447 | 447 |
| 448 if (EndsWith(timestamp_str, "K", true)) { | 448 if (EndsWith(timestamp_str, "K", true)) { |
| 449 block_info.flags = kWebMFlagKeyframe; | 449 block_info.flags = kWebMFlagKeyframe; |
| 450 // Remove the "K" off of the token. | 450 // Remove the "K" off of the token. |
| 451 timestamp_str = timestamp_str.substr(0, timestamps[i].length() - 1); | 451 timestamp_str = timestamp_str.substr(0, timestamps[i].length() - 1); |
| 452 } | 452 } |
| 453 CHECK(base::StringToInt(timestamp_str, &block_info.timestamp_in_ms)); | 453 CHECK(base::StringToInt(timestamp_str, &block_info.timestamp_in_ms)); |
| 454 | 454 |
| 455 if (track_number == kTextTrackNum || | 455 if (track_number == kTextTrackNum || |
| 456 track_number == kAlternateTextTrackNum) { | 456 track_number == kAlternateTextTrackNum) { |
| 457 block_info.duration = kTextBlockDuration; | 457 block_info.duration = kTextBlockDuration; |
| 458 ASSERT_EQ(kWebMFlagKeyframe, block_info.flags) | 458 ASSERT_EQ(kWebMFlagKeyframe, block_info.flags) |
| 459 << "Text block with timestamp " << block_info.timestamp_in_ms | 459 << "Text block with timestamp " << block_info.timestamp_in_ms |
| 460 << " was not marked as a keyframe." | 460 << " was not marked as a key frame." |
| 461 << " All text blocks must be keyframes"; | 461 << " All text blocks must be key frames"; |
| 462 } | 462 } |
| 463 | 463 |
| 464 if (track_number == kAudioTrackNum) | 464 if (track_number == kAudioTrackNum) |
| 465 ASSERT_TRUE(block_info.flags & kWebMFlagKeyframe); | 465 ASSERT_TRUE(block_info.flags & kWebMFlagKeyframe); |
| 466 | 466 |
| 467 blocks->push_back(block_info); | 467 blocks->push_back(block_info); |
| 468 } | 468 } |
| 469 } | 469 } |
| 470 | 470 |
| 471 scoped_ptr<Cluster> GenerateCluster(const std::vector<BlockInfo>& blocks, | 471 scoped_ptr<Cluster> GenerateCluster(const std::vector<BlockInfo>& blocks, |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 first_audio_timecode, | 834 first_audio_timecode, |
| 835 kWebMFlagKeyframe, | 835 kWebMFlagKeyframe, |
| 836 kAudioBlockDuration)); | 836 kAudioBlockDuration)); |
| 837 return GenerateCluster(block_queue, unknown_size); | 837 return GenerateCluster(block_queue, unknown_size); |
| 838 } | 838 } |
| 839 | 839 |
| 840 int audio_timecode = first_audio_timecode; | 840 int audio_timecode = first_audio_timecode; |
| 841 int video_timecode = first_video_timecode; | 841 int video_timecode = first_video_timecode; |
| 842 | 842 |
| 843 // Create simple blocks for everything except the last 2 blocks. | 843 // Create simple blocks for everything except the last 2 blocks. |
| 844 // The first video frame must be a keyframe. | 844 // The first video frame must be a key frame. |
| 845 uint8 video_flag = kWebMFlagKeyframe; | 845 uint8 video_flag = kWebMFlagKeyframe; |
| 846 for (int i = 0; i < block_count - 2; i++) { | 846 for (int i = 0; i < block_count - 2; i++) { |
| 847 if (audio_timecode <= video_timecode) { | 847 if (audio_timecode <= video_timecode) { |
| 848 block_queue.push(BlockInfo(kAudioTrackNum, | 848 block_queue.push(BlockInfo(kAudioTrackNum, |
| 849 audio_timecode, | 849 audio_timecode, |
| 850 kWebMFlagKeyframe, | 850 kWebMFlagKeyframe, |
| 851 0)); | 851 0)); |
| 852 audio_timecode += kAudioBlockDuration; | 852 audio_timecode += kAudioBlockDuration; |
| 853 continue; | 853 continue; |
| 854 } | 854 } |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 stream->Read(base::Bind(&ChunkDemuxerTest::StoreStatusAndBuffer, | 1067 stream->Read(base::Bind(&ChunkDemuxerTest::StoreStatusAndBuffer, |
| 1068 base::Unretained(this), &status, &buffer)); | 1068 base::Unretained(this), &status, &buffer)); |
| 1069 base::MessageLoop::current()->RunUntilIdle(); | 1069 base::MessageLoop::current()->RunUntilIdle(); |
| 1070 if (status != DemuxerStream::kOk || buffer->end_of_stream()) | 1070 if (status != DemuxerStream::kOk || buffer->end_of_stream()) |
| 1071 break; | 1071 break; |
| 1072 | 1072 |
| 1073 if (i > 0) | 1073 if (i > 0) |
| 1074 ss << " "; | 1074 ss << " "; |
| 1075 ss << buffer->timestamp().InMilliseconds(); | 1075 ss << buffer->timestamp().InMilliseconds(); |
| 1076 | 1076 |
| 1077 if (buffer->is_key_frame()) |
| 1078 ss << "K"; |
| 1079 |
| 1077 // Handle preroll buffers. | 1080 // Handle preroll buffers. |
| 1078 if (EndsWith(timestamps[i], "P", true)) { | 1081 if (EndsWith(timestamps[i], "P", true)) { |
| 1079 ASSERT_EQ(kInfiniteDuration(), buffer->discard_padding().first); | 1082 ASSERT_EQ(kInfiniteDuration(), buffer->discard_padding().first); |
| 1080 ASSERT_EQ(base::TimeDelta(), buffer->discard_padding().second); | 1083 ASSERT_EQ(base::TimeDelta(), buffer->discard_padding().second); |
| 1081 ss << "P"; | 1084 ss << "P"; |
| 1082 } | 1085 } |
| 1083 } | 1086 } |
| 1084 EXPECT_EQ(expected, ss.str()); | 1087 EXPECT_EQ(expected, ss.str()); |
| 1085 } | 1088 } |
| 1086 | 1089 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 append_window_end_for_next_append_, | 1380 append_window_end_for_next_append_, |
| 1378 ×tamp_offset_map_[kSourceId], | 1381 ×tamp_offset_map_[kSourceId], |
| 1379 init_segment_received_cb_); | 1382 init_segment_received_cb_); |
| 1380 | 1383 |
| 1381 AppendMuxedCluster( | 1384 AppendMuxedCluster( |
| 1382 MuxedStreamInfo(kAudioTrackNum, "46K 69K"), | 1385 MuxedStreamInfo(kAudioTrackNum, "46K 69K"), |
| 1383 MuxedStreamInfo(kVideoTrackNum, "60K"), | 1386 MuxedStreamInfo(kVideoTrackNum, "60K"), |
| 1384 MuxedStreamInfo(kAlternateTextTrackNum, "45K")); | 1387 MuxedStreamInfo(kAlternateTextTrackNum, "45K")); |
| 1385 | 1388 |
| 1386 CheckExpectedRanges(kSourceId, "{ [0,92) }"); | 1389 CheckExpectedRanges(kSourceId, "{ [0,92) }"); |
| 1387 CheckExpectedBuffers(audio_stream, "0 23 46 69"); | 1390 CheckExpectedBuffers(audio_stream, "0K 23K 46K 69K"); |
| 1388 CheckExpectedBuffers(video_stream, "0 30 60"); | 1391 CheckExpectedBuffers(video_stream, "0K 30 60K"); |
| 1389 CheckExpectedBuffers(text_stream, "10 45"); | 1392 CheckExpectedBuffers(text_stream, "10K 45K"); |
| 1390 | 1393 |
| 1391 ShutdownDemuxer(); | 1394 ShutdownDemuxer(); |
| 1392 } | 1395 } |
| 1393 | 1396 |
| 1394 TEST_F(ChunkDemuxerTest, InitSegmentSetsNeedRandomAccessPointFlag) { | 1397 TEST_F(ChunkDemuxerTest, InitSegmentSetsNeedRandomAccessPointFlag) { |
| 1395 // Tests that non-keyframes following an init segment are allowed | 1398 // Tests that non-key-frames following an init segment are allowed |
| 1396 // and dropped, as expected if the initialization segment received | 1399 // and dropped, as expected if the initialization segment received |
| 1397 // algorithm correctly sets the needs random access point flag to true for all | 1400 // algorithm correctly sets the needs random access point flag to true for all |
| 1398 // track buffers. Note that the first initialization segment is insufficient | 1401 // track buffers. Note that the first initialization segment is insufficient |
| 1399 // to fully test this since needs random access point flag initializes to | 1402 // to fully test this since needs random access point flag initializes to |
| 1400 // true. | 1403 // true. |
| 1401 CreateNewDemuxer(); | 1404 CreateNewDemuxer(); |
| 1402 DemuxerStream* text_stream = NULL; | 1405 DemuxerStream* text_stream = NULL; |
| 1403 EXPECT_CALL(host_, AddTextStream(_, _)) | 1406 EXPECT_CALL(host_, AddTextStream(_, _)) |
| 1404 .WillOnce(SaveArg<0>(&text_stream)); | 1407 .WillOnce(SaveArg<0>(&text_stream)); |
| 1405 ASSERT_TRUE(InitDemuxerWithEncryptionInfo( | 1408 ASSERT_TRUE(InitDemuxerWithEncryptionInfo( |
| 1406 HAS_TEXT | HAS_AUDIO | HAS_VIDEO, false, false)); | 1409 HAS_TEXT | HAS_AUDIO | HAS_VIDEO, false, false)); |
| 1407 DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO); | 1410 DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO); |
| 1408 DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::VIDEO); | 1411 DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::VIDEO); |
| 1409 ASSERT_TRUE(audio_stream && video_stream && text_stream); | 1412 ASSERT_TRUE(audio_stream && video_stream && text_stream); |
| 1410 | 1413 |
| 1411 AppendMuxedCluster( | 1414 AppendMuxedCluster( |
| 1412 MuxedStreamInfo(kAudioTrackNum, "23K"), | 1415 MuxedStreamInfo(kAudioTrackNum, "23K"), |
| 1413 MuxedStreamInfo(kVideoTrackNum, "0 30K"), | 1416 MuxedStreamInfo(kVideoTrackNum, "0 30K"), |
| 1414 MuxedStreamInfo(kTextTrackNum, "25K 40K")); | 1417 MuxedStreamInfo(kTextTrackNum, "25K 40K")); |
| 1415 CheckExpectedRanges(kSourceId, "{ [23,46) }"); | 1418 CheckExpectedRanges(kSourceId, "{ [23,46) }"); |
| 1416 | 1419 |
| 1417 EXPECT_CALL(*this, InitSegmentReceived()); | 1420 EXPECT_CALL(*this, InitSegmentReceived()); |
| 1418 AppendInitSegment(HAS_TEXT | HAS_AUDIO | HAS_VIDEO); | 1421 AppendInitSegment(HAS_TEXT | HAS_AUDIO | HAS_VIDEO); |
| 1419 AppendMuxedCluster( | 1422 AppendMuxedCluster( |
| 1420 MuxedStreamInfo(kAudioTrackNum, "46K 69K"), | 1423 MuxedStreamInfo(kAudioTrackNum, "46K 69K"), |
| 1421 MuxedStreamInfo(kVideoTrackNum, "60 90K"), | 1424 MuxedStreamInfo(kVideoTrackNum, "60 90K"), |
| 1422 MuxedStreamInfo(kTextTrackNum, "80K 90K")); | 1425 MuxedStreamInfo(kTextTrackNum, "80K 90K")); |
| 1423 CheckExpectedRanges(kSourceId, "{ [23,92) }"); | 1426 CheckExpectedRanges(kSourceId, "{ [23,92) }"); |
| 1424 | 1427 |
| 1425 CheckExpectedBuffers(audio_stream, "23 46 69"); | 1428 CheckExpectedBuffers(audio_stream, "23K 46K 69K"); |
| 1426 CheckExpectedBuffers(video_stream, "30 90"); | 1429 CheckExpectedBuffers(video_stream, "30K 90K"); |
| 1427 CheckExpectedBuffers(text_stream, "25 40 80 90"); | 1430 CheckExpectedBuffers(text_stream, "25K 40K 80K 90K"); |
| 1428 } | 1431 } |
| 1429 | 1432 |
| 1430 // Make sure that the demuxer reports an error if Shutdown() | 1433 // Make sure that the demuxer reports an error if Shutdown() |
| 1431 // is called before all the initialization segments are appended. | 1434 // is called before all the initialization segments are appended. |
| 1432 TEST_F(ChunkDemuxerTest, Shutdown_BeforeAllInitSegmentsAppended) { | 1435 TEST_F(ChunkDemuxerTest, Shutdown_BeforeAllInitSegmentsAppended) { |
| 1433 EXPECT_CALL(*this, DemuxerOpened()); | 1436 EXPECT_CALL(*this, DemuxerOpened()); |
| 1434 demuxer_->Initialize( | 1437 demuxer_->Initialize( |
| 1435 &host_, CreateInitDoneCB( | 1438 &host_, CreateInitDoneCB( |
| 1436 kDefaultDuration(), DEMUXER_ERROR_COULD_NOT_OPEN), true); | 1439 kDefaultDuration(), DEMUXER_ERROR_COULD_NOT_OPEN), true); |
| 1437 | 1440 |
| (...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3402 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(280); | 3405 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(280); |
| 3403 | 3406 |
| 3404 // Append a cluster that starts before and ends after the append window. | 3407 // Append a cluster that starts before and ends after the append window. |
| 3405 AppendSingleStreamCluster(kSourceId, kVideoTrackNum, | 3408 AppendSingleStreamCluster(kSourceId, kVideoTrackNum, |
| 3406 "0K 30 60 90 120K 150 180 210 240K 270 300 330K"); | 3409 "0K 30 60 90 120K 150 180 210 240K 270 300 330K"); |
| 3407 | 3410 |
| 3408 // Verify that GOPs that start outside the window are not included | 3411 // Verify that GOPs that start outside the window are not included |
| 3409 // in the buffer. Also verify that buffers that start inside the | 3412 // in the buffer. Also verify that buffers that start inside the |
| 3410 // window and extend beyond the end of the window are not included. | 3413 // window and extend beyond the end of the window are not included. |
| 3411 CheckExpectedRanges(kSourceId, "{ [120,270) }"); | 3414 CheckExpectedRanges(kSourceId, "{ [120,270) }"); |
| 3412 CheckExpectedBuffers(stream, "120 150 180 210 240"); | 3415 CheckExpectedBuffers(stream, "120K 150 180 210 240K"); |
| 3413 | 3416 |
| 3414 // Extend the append window to [50,650). | 3417 // Extend the append window to [50,650). |
| 3415 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(650); | 3418 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(650); |
| 3416 | 3419 |
| 3417 // Append more data and verify that adding buffers start at the next | 3420 // Append more data and verify that adding buffers start at the next |
| 3418 // keyframe. | 3421 // key frame. |
| 3419 AppendSingleStreamCluster(kSourceId, kVideoTrackNum, | 3422 AppendSingleStreamCluster(kSourceId, kVideoTrackNum, |
| 3420 "360 390 420K 450 480 510 540K 570 600 630K"); | 3423 "360 390 420K 450 480 510 540K 570 600 630K"); |
| 3421 CheckExpectedRanges(kSourceId, "{ [120,270) [420,630) }"); | 3424 CheckExpectedRanges(kSourceId, "{ [120,270) [420,630) }"); |
| 3422 } | 3425 } |
| 3423 | 3426 |
| 3424 TEST_F(ChunkDemuxerTest, AppendWindow_Audio) { | 3427 TEST_F(ChunkDemuxerTest, AppendWindow_Audio) { |
| 3425 ASSERT_TRUE(InitDemuxer(HAS_AUDIO)); | 3428 ASSERT_TRUE(InitDemuxer(HAS_AUDIO)); |
| 3426 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::AUDIO); | 3429 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::AUDIO); |
| 3427 | 3430 |
| 3428 // Set the append window to [50,280). | 3431 // Set the append window to [50,280). |
| 3429 append_window_start_for_next_append_ = base::TimeDelta::FromMilliseconds(50); | 3432 append_window_start_for_next_append_ = base::TimeDelta::FromMilliseconds(50); |
| 3430 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(280); | 3433 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(280); |
| 3431 | 3434 |
| 3432 // Append a cluster that starts before and ends after the append window. | 3435 // Append a cluster that starts before and ends after the append window. |
| 3433 AppendSingleStreamCluster( | 3436 AppendSingleStreamCluster( |
| 3434 kSourceId, kAudioTrackNum, | 3437 kSourceId, kAudioTrackNum, |
| 3435 "0K 30K 60K 90K 120K 150K 180K 210K 240K 270K 300K 330K"); | 3438 "0K 30K 60K 90K 120K 150K 180K 210K 240K 270K 300K 330K"); |
| 3436 | 3439 |
| 3437 // Verify that frames that end outside the window are not included | 3440 // Verify that frames that end outside the window are not included |
| 3438 // in the buffer. Also verify that buffers that start inside the | 3441 // in the buffer. Also verify that buffers that start inside the |
| 3439 // window and extend beyond the end of the window are not included. | 3442 // window and extend beyond the end of the window are not included. |
| 3440 // | 3443 // |
| 3441 // The first 50ms of the range should be truncated since it overlaps | 3444 // The first 50ms of the range should be truncated since it overlaps |
| 3442 // the start of the append window. | 3445 // the start of the append window. |
| 3443 CheckExpectedRanges(kSourceId, "{ [50,280) }"); | 3446 CheckExpectedRanges(kSourceId, "{ [50,280) }"); |
| 3444 | 3447 |
| 3445 // The "50P" buffer is the "0" buffer marked for complete discard. The next | 3448 // The "50P" buffer is the "0" buffer marked for complete discard. The next |
| 3446 // "50" buffer is the "30" buffer marked with 20ms of start discard. | 3449 // "50" buffer is the "30" buffer marked with 20ms of start discard. |
| 3447 CheckExpectedBuffers(stream, "50P 50 60 90 120 150 180 210 240"); | 3450 CheckExpectedBuffers(stream, "50KP 50K 60K 90K 120K 150K 180K 210K 240K"); |
| 3448 | 3451 |
| 3449 // Extend the append window to [50,650). | 3452 // Extend the append window to [50,650). |
| 3450 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(650); | 3453 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(650); |
| 3451 | 3454 |
| 3452 // Append more data and verify that a new range is created. | 3455 // Append more data and verify that a new range is created. |
| 3453 AppendSingleStreamCluster( | 3456 AppendSingleStreamCluster( |
| 3454 kSourceId, kAudioTrackNum, | 3457 kSourceId, kAudioTrackNum, |
| 3455 "360K 390K 420K 450K 480K 510K 540K 570K 600K 630K"); | 3458 "360K 390K 420K 450K 480K 510K 540K 570K 600K 630K"); |
| 3456 CheckExpectedRanges(kSourceId, "{ [50,280) [360,650) }"); | 3459 CheckExpectedRanges(kSourceId, "{ [50,280) [360,650) }"); |
| 3457 } | 3460 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 3484 | 3487 |
| 3485 // Read a WebM file into memory and send the data to the demuxer. The chunk | 3488 // Read a WebM file into memory and send the data to the demuxer. The chunk |
| 3486 // size has been chosen carefully to ensure the preroll buffer used by the | 3489 // size has been chosen carefully to ensure the preroll buffer used by the |
| 3487 // partial append window trim must come from a previous Append() call. | 3490 // partial append window trim must come from a previous Append() call. |
| 3488 scoped_refptr<DecoderBuffer> buffer = | 3491 scoped_refptr<DecoderBuffer> buffer = |
| 3489 ReadTestDataFile("bear-320x240-audio-only.webm"); | 3492 ReadTestDataFile("bear-320x240-audio-only.webm"); |
| 3490 EXPECT_CALL(*this, InitSegmentReceived()); | 3493 EXPECT_CALL(*this, InitSegmentReceived()); |
| 3491 AppendDataInPieces(buffer->data(), buffer->data_size(), 128); | 3494 AppendDataInPieces(buffer->data(), buffer->data_size(), 128); |
| 3492 | 3495 |
| 3493 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::AUDIO); | 3496 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::AUDIO); |
| 3494 CheckExpectedBuffers(stream, "50P 50 62 86 109 122 125 128"); | 3497 CheckExpectedBuffers(stream, "50KP 50K 62K 86K 109K 122K 125K 128K"); |
| 3495 } | 3498 } |
| 3496 | 3499 |
| 3497 TEST_F(ChunkDemuxerTest, AppendWindow_AudioConfigUpdateRemovesPreroll) { | 3500 TEST_F(ChunkDemuxerTest, AppendWindow_AudioConfigUpdateRemovesPreroll) { |
| 3498 EXPECT_CALL(*this, DemuxerOpened()); | 3501 EXPECT_CALL(*this, DemuxerOpened()); |
| 3499 demuxer_->Initialize( | 3502 demuxer_->Initialize( |
| 3500 &host_, | 3503 &host_, |
| 3501 CreateInitDoneCB(base::TimeDelta::FromMilliseconds(2744), PIPELINE_OK), | 3504 CreateInitDoneCB(base::TimeDelta::FromMilliseconds(2744), PIPELINE_OK), |
| 3502 true); | 3505 true); |
| 3503 ASSERT_EQ(ChunkDemuxer::kOk, AddId(kSourceId, HAS_AUDIO)); | 3506 ASSERT_EQ(ChunkDemuxer::kOk, AddId(kSourceId, HAS_AUDIO)); |
| 3504 | 3507 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3526 ReadTestDataFile("bear-320x240-audio-only-48khz.webm"); | 3529 ReadTestDataFile("bear-320x240-audio-only-48khz.webm"); |
| 3527 EXPECT_CALL(*this, InitSegmentReceived()); | 3530 EXPECT_CALL(*this, InitSegmentReceived()); |
| 3528 EXPECT_CALL(host_, SetDuration(_)).Times(AnyNumber()); | 3531 EXPECT_CALL(host_, SetDuration(_)).Times(AnyNumber()); |
| 3529 ASSERT_TRUE(SetTimestampOffset(kSourceId, duration_1)); | 3532 ASSERT_TRUE(SetTimestampOffset(kSourceId, duration_1)); |
| 3530 AppendDataInPieces(buffer2->data(), buffer2->data_size(), 512); | 3533 AppendDataInPieces(buffer2->data(), buffer2->data_size(), 512); |
| 3531 CheckExpectedRanges(kSourceId, "{ [2746,5519) }"); | 3534 CheckExpectedRanges(kSourceId, "{ [2746,5519) }"); |
| 3532 | 3535 |
| 3533 Seek(duration_1); | 3536 Seek(duration_1); |
| 3534 ExpectConfigChanged(DemuxerStream::AUDIO); | 3537 ExpectConfigChanged(DemuxerStream::AUDIO); |
| 3535 ASSERT_FALSE(config_1.Matches(stream->audio_decoder_config())); | 3538 ASSERT_FALSE(config_1.Matches(stream->audio_decoder_config())); |
| 3536 CheckExpectedBuffers(stream, "2746 2767 2789 2810"); | 3539 CheckExpectedBuffers(stream, "2746K 2767K 2789K 2810K"); |
| 3537 } | 3540 } |
| 3538 | 3541 |
| 3539 TEST_F(ChunkDemuxerTest, AppendWindow_Text) { | 3542 TEST_F(ChunkDemuxerTest, AppendWindow_Text) { |
| 3540 DemuxerStream* text_stream = NULL; | 3543 DemuxerStream* text_stream = NULL; |
| 3541 EXPECT_CALL(host_, AddTextStream(_, _)) | 3544 EXPECT_CALL(host_, AddTextStream(_, _)) |
| 3542 .WillOnce(SaveArg<0>(&text_stream)); | 3545 .WillOnce(SaveArg<0>(&text_stream)); |
| 3543 ASSERT_TRUE(InitDemuxer(HAS_VIDEO | HAS_TEXT)); | 3546 ASSERT_TRUE(InitDemuxer(HAS_VIDEO | HAS_TEXT)); |
| 3544 DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::VIDEO); | 3547 DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::VIDEO); |
| 3545 | 3548 |
| 3546 // Set the append window to [20,280). | 3549 // Set the append window to [20,280). |
| 3547 append_window_start_for_next_append_ = base::TimeDelta::FromMilliseconds(20); | 3550 append_window_start_for_next_append_ = base::TimeDelta::FromMilliseconds(20); |
| 3548 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(280); | 3551 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(280); |
| 3549 | 3552 |
| 3550 // Append a cluster that starts before and ends after the append | 3553 // Append a cluster that starts before and ends after the append |
| 3551 // window. | 3554 // window. |
| 3552 AppendMuxedCluster( | 3555 AppendMuxedCluster( |
| 3553 MuxedStreamInfo(kVideoTrackNum, | 3556 MuxedStreamInfo(kVideoTrackNum, |
| 3554 "0K 30 60 90 120K 150 180 210 240K 270 300 330K"), | 3557 "0K 30 60 90 120K 150 180 210 240K 270 300 330K"), |
| 3555 MuxedStreamInfo(kTextTrackNum, "0K 100K 200K 300K" )); | 3558 MuxedStreamInfo(kTextTrackNum, "0K 100K 200K 300K" )); |
| 3556 | 3559 |
| 3557 // Verify that text cues that start outside the window are not included | 3560 // Verify that text cues that start outside the window are not included |
| 3558 // in the buffer. Also verify that cues that extend beyond the | 3561 // in the buffer. Also verify that cues that extend beyond the |
| 3559 // window are not included. | 3562 // window are not included. |
| 3560 CheckExpectedRanges(kSourceId, "{ [100,270) }"); | 3563 CheckExpectedRanges(kSourceId, "{ [100,270) }"); |
| 3561 CheckExpectedBuffers(video_stream, "120 150 180 210 240"); | 3564 CheckExpectedBuffers(video_stream, "120K 150 180 210 240K"); |
| 3562 CheckExpectedBuffers(text_stream, "100"); | 3565 CheckExpectedBuffers(text_stream, "100K"); |
| 3563 | 3566 |
| 3564 // Extend the append window to [20,650). | 3567 // Extend the append window to [20,650). |
| 3565 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(650); | 3568 append_window_end_for_next_append_ = base::TimeDelta::FromMilliseconds(650); |
| 3566 | 3569 |
| 3567 // Append more data and verify that a new range is created. | 3570 // Append more data and verify that a new range is created. |
| 3568 AppendMuxedCluster( | 3571 AppendMuxedCluster( |
| 3569 MuxedStreamInfo(kVideoTrackNum, | 3572 MuxedStreamInfo(kVideoTrackNum, |
| 3570 "360 390 420K 450 480 510 540K 570 600 630K"), | 3573 "360 390 420K 450 480 510 540K 570 600 630K"), |
| 3571 MuxedStreamInfo(kTextTrackNum, "400K 500K 600K 700K" )); | 3574 MuxedStreamInfo(kTextTrackNum, "400K 500K 600K 700K" )); |
| 3572 CheckExpectedRanges(kSourceId, "{ [100,270) [400,630) }"); | 3575 CheckExpectedRanges(kSourceId, "{ [100,270) [400,630) }"); |
| 3573 | 3576 |
| 3574 // Seek to the new range and verify that the expected buffers are returned. | 3577 // Seek to the new range and verify that the expected buffers are returned. |
| 3575 Seek(base::TimeDelta::FromMilliseconds(420)); | 3578 Seek(base::TimeDelta::FromMilliseconds(420)); |
| 3576 CheckExpectedBuffers(video_stream, "420 450 480 510 540 570 600"); | 3579 CheckExpectedBuffers(video_stream, "420K 450 480 510 540K 570 600"); |
| 3577 CheckExpectedBuffers(text_stream, "400 500"); | 3580 CheckExpectedBuffers(text_stream, "400K 500K"); |
| 3578 } | 3581 } |
| 3579 | 3582 |
| 3580 TEST_F(ChunkDemuxerTest, StartWaitingForSeekAfterParseError) { | 3583 TEST_F(ChunkDemuxerTest, StartWaitingForSeekAfterParseError) { |
| 3581 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); | 3584 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); |
| 3582 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); | 3585 EXPECT_CALL(host_, OnDemuxerError(PIPELINE_ERROR_DECODE)); |
| 3583 AppendGarbage(); | 3586 AppendGarbage(); |
| 3584 base::TimeDelta seek_time = base::TimeDelta::FromSeconds(50); | 3587 base::TimeDelta seek_time = base::TimeDelta::FromSeconds(50); |
| 3585 demuxer_->StartWaitingForSeek(seek_time); | 3588 demuxer_->StartWaitingForSeek(seek_time); |
| 3586 } | 3589 } |
| 3587 | 3590 |
| 3588 TEST_F(ChunkDemuxerTest, Remove_AudioVideoText) { | 3591 TEST_F(ChunkDemuxerTest, Remove_AudioVideoText) { |
| 3589 DemuxerStream* text_stream = NULL; | 3592 DemuxerStream* text_stream = NULL; |
| 3590 EXPECT_CALL(host_, AddTextStream(_, _)) | 3593 EXPECT_CALL(host_, AddTextStream(_, _)) |
| 3591 .WillOnce(SaveArg<0>(&text_stream)); | 3594 .WillOnce(SaveArg<0>(&text_stream)); |
| 3592 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO | HAS_TEXT)); | 3595 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO | HAS_TEXT)); |
| 3593 | 3596 |
| 3594 DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO); | 3597 DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO); |
| 3595 DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::VIDEO); | 3598 DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::VIDEO); |
| 3596 | 3599 |
| 3597 AppendMuxedCluster( | 3600 AppendMuxedCluster( |
| 3598 MuxedStreamInfo(kAudioTrackNum, "0K 20K 40K 60K 80K 100K 120K 140K"), | 3601 MuxedStreamInfo(kAudioTrackNum, "0K 20K 40K 60K 80K 100K 120K 140K"), |
| 3599 MuxedStreamInfo(kVideoTrackNum, "0K 30 60 90 120K 150 180"), | 3602 MuxedStreamInfo(kVideoTrackNum, "0K 30 60 90 120K 150 180"), |
| 3600 MuxedStreamInfo(kTextTrackNum, "0K 100K 200K")); | 3603 MuxedStreamInfo(kTextTrackNum, "0K 100K 200K")); |
| 3601 | 3604 |
| 3602 CheckExpectedBuffers(audio_stream, "0 20 40 60 80 100 120 140"); | 3605 CheckExpectedBuffers(audio_stream, "0K 20K 40K 60K 80K 100K 120K 140K"); |
| 3603 CheckExpectedBuffers(video_stream, "0 30 60 90 120 150 180"); | 3606 CheckExpectedBuffers(video_stream, "0K 30 60 90 120K 150 180"); |
| 3604 CheckExpectedBuffers(text_stream, "0 100 200"); | 3607 CheckExpectedBuffers(text_stream, "0K 100K 200K"); |
| 3605 | 3608 |
| 3606 // Remove the buffers that were added. | 3609 // Remove the buffers that were added. |
| 3607 demuxer_->Remove(kSourceId, base::TimeDelta(), | 3610 demuxer_->Remove(kSourceId, base::TimeDelta(), |
| 3608 base::TimeDelta::FromMilliseconds(300)); | 3611 base::TimeDelta::FromMilliseconds(300)); |
| 3609 | 3612 |
| 3610 // Verify that all the appended data has been removed. | 3613 // Verify that all the appended data has been removed. |
| 3611 CheckExpectedRanges(kSourceId, "{ }"); | 3614 CheckExpectedRanges(kSourceId, "{ }"); |
| 3612 | 3615 |
| 3613 // Append new buffers that are clearly different than the original | 3616 // Append new buffers that are clearly different than the original |
| 3614 // ones and verify that only the new buffers are returned. | 3617 // ones and verify that only the new buffers are returned. |
| 3615 AppendMuxedCluster( | 3618 AppendMuxedCluster( |
| 3616 MuxedStreamInfo(kAudioTrackNum, "1K 21K 41K 61K 81K 101K 121K 141K"), | 3619 MuxedStreamInfo(kAudioTrackNum, "1K 21K 41K 61K 81K 101K 121K 141K"), |
| 3617 MuxedStreamInfo(kVideoTrackNum, "1K 31 61 91 121K 151 181"), | 3620 MuxedStreamInfo(kVideoTrackNum, "1K 31 61 91 121K 151 181"), |
| 3618 MuxedStreamInfo(kTextTrackNum, "1K 101K 201K")); | 3621 MuxedStreamInfo(kTextTrackNum, "1K 101K 201K")); |
| 3619 | 3622 |
| 3620 Seek(base::TimeDelta()); | 3623 Seek(base::TimeDelta()); |
| 3621 CheckExpectedBuffers(audio_stream, "1 21 41 61 81 101 121 141"); | 3624 CheckExpectedBuffers(audio_stream, "1K 21K 41K 61K 81K 101K 121K 141K"); |
| 3622 CheckExpectedBuffers(video_stream, "1 31 61 91 121 151 181"); | 3625 CheckExpectedBuffers(video_stream, "1K 31 61 91 121K 151 181"); |
| 3623 CheckExpectedBuffers(text_stream, "1 101 201"); | 3626 CheckExpectedBuffers(text_stream, "1K 101K 201K"); |
| 3624 } | 3627 } |
| 3625 | 3628 |
| 3626 TEST_F(ChunkDemuxerTest, Remove_StartAtDuration) { | 3629 TEST_F(ChunkDemuxerTest, Remove_StartAtDuration) { |
| 3627 ASSERT_TRUE(InitDemuxer(HAS_AUDIO)); | 3630 ASSERT_TRUE(InitDemuxer(HAS_AUDIO)); |
| 3628 DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO); | 3631 DemuxerStream* audio_stream = demuxer_->GetStream(DemuxerStream::AUDIO); |
| 3629 | 3632 |
| 3630 // Set the duration to something small so that the append that | 3633 // Set the duration to something small so that the append that |
| 3631 // follows updates the duration to reflect the end of the appended data. | 3634 // follows updates the duration to reflect the end of the appended data. |
| 3632 EXPECT_CALL(host_, SetDuration( | 3635 EXPECT_CALL(host_, SetDuration( |
| 3633 base::TimeDelta::FromMilliseconds(1))); | 3636 base::TimeDelta::FromMilliseconds(1))); |
| 3634 demuxer_->SetDuration(0.001); | 3637 demuxer_->SetDuration(0.001); |
| 3635 | 3638 |
| 3636 EXPECT_CALL(host_, SetDuration( | 3639 EXPECT_CALL(host_, SetDuration( |
| 3637 base::TimeDelta::FromMilliseconds(160))); | 3640 base::TimeDelta::FromMilliseconds(160))); |
| 3638 AppendSingleStreamCluster(kSourceId, kAudioTrackNum, | 3641 AppendSingleStreamCluster(kSourceId, kAudioTrackNum, |
| 3639 "0K 20K 40K 60K 80K 100K 120K 140K"); | 3642 "0K 20K 40K 60K 80K 100K 120K 140K"); |
| 3640 | 3643 |
| 3641 CheckExpectedRanges(kSourceId, "{ [0,160) }"); | 3644 CheckExpectedRanges(kSourceId, "{ [0,160) }"); |
| 3642 CheckExpectedBuffers(audio_stream, "0 20 40 60 80 100 120 140"); | 3645 CheckExpectedBuffers(audio_stream, "0K 20K 40K 60K 80K 100K 120K 140K"); |
| 3643 | 3646 |
| 3644 demuxer_->Remove(kSourceId, | 3647 demuxer_->Remove(kSourceId, |
| 3645 base::TimeDelta::FromSecondsD(demuxer_->GetDuration()), | 3648 base::TimeDelta::FromSecondsD(demuxer_->GetDuration()), |
| 3646 kInfiniteDuration()); | 3649 kInfiniteDuration()); |
| 3647 | 3650 |
| 3648 Seek(base::TimeDelta()); | 3651 Seek(base::TimeDelta()); |
| 3649 CheckExpectedRanges(kSourceId, "{ [0,160) }"); | 3652 CheckExpectedRanges(kSourceId, "{ [0,160) }"); |
| 3650 CheckExpectedBuffers(audio_stream, "0 20 40 60 80 100 120 140"); | 3653 CheckExpectedBuffers(audio_stream, "0K 20K 40K 60K 80K 100K 120K 140K"); |
| 3651 } | 3654 } |
| 3652 | 3655 |
| 3653 // Verifies that a Seek() will complete without text cues for | 3656 // Verifies that a Seek() will complete without text cues for |
| 3654 // the seek point and will return cues after the seek position | 3657 // the seek point and will return cues after the seek position |
| 3655 // when they are eventually appended. | 3658 // when they are eventually appended. |
| 3656 TEST_F(ChunkDemuxerTest, SeekCompletesWithoutTextCues) { | 3659 TEST_F(ChunkDemuxerTest, SeekCompletesWithoutTextCues) { |
| 3657 DemuxerStream* text_stream = NULL; | 3660 DemuxerStream* text_stream = NULL; |
| 3658 EXPECT_CALL(host_, AddTextStream(_, _)) | 3661 EXPECT_CALL(host_, AddTextStream(_, _)) |
| 3659 .WillOnce(SaveArg<0>(&text_stream)); | 3662 .WillOnce(SaveArg<0>(&text_stream)); |
| 3660 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO | HAS_TEXT)); | 3663 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO | HAS_TEXT)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3680 AppendMuxedCluster( | 3683 AppendMuxedCluster( |
| 3681 MuxedStreamInfo(kAudioTrackNum, | 3684 MuxedStreamInfo(kAudioTrackNum, |
| 3682 "0K 20K 40K 60K 80K 100K 120K 140K 160K 180K 200K"), | 3685 "0K 20K 40K 60K 80K 100K 120K 140K 160K 180K 200K"), |
| 3683 MuxedStreamInfo(kVideoTrackNum, "0K 30 60 90 120K 150 180 210")); | 3686 MuxedStreamInfo(kVideoTrackNum, "0K 30 60 90 120K 150 180 210")); |
| 3684 | 3687 |
| 3685 message_loop_.RunUntilIdle(); | 3688 message_loop_.RunUntilIdle(); |
| 3686 EXPECT_TRUE(seek_cb_was_called); | 3689 EXPECT_TRUE(seek_cb_was_called); |
| 3687 EXPECT_FALSE(text_read_done); | 3690 EXPECT_FALSE(text_read_done); |
| 3688 | 3691 |
| 3689 // Read some audio & video buffers to further verify seek completion. | 3692 // Read some audio & video buffers to further verify seek completion. |
| 3690 CheckExpectedBuffers(audio_stream, "120 140"); | 3693 CheckExpectedBuffers(audio_stream, "120K 140K"); |
| 3691 CheckExpectedBuffers(video_stream, "120 150"); | 3694 CheckExpectedBuffers(video_stream, "120K 150"); |
| 3692 | 3695 |
| 3693 EXPECT_FALSE(text_read_done); | 3696 EXPECT_FALSE(text_read_done); |
| 3694 | 3697 |
| 3695 // Append text cues that start after the seek point and verify that | 3698 // Append text cues that start after the seek point and verify that |
| 3696 // they are returned by Read() calls. | 3699 // they are returned by Read() calls. |
| 3697 AppendMuxedCluster( | 3700 AppendMuxedCluster( |
| 3698 MuxedStreamInfo(kAudioTrackNum, "220K 240K 260K 280K"), | 3701 MuxedStreamInfo(kAudioTrackNum, "220K 240K 260K 280K"), |
| 3699 MuxedStreamInfo(kVideoTrackNum, "240K 270 300 330"), | 3702 MuxedStreamInfo(kVideoTrackNum, "240K 270 300 330"), |
| 3700 MuxedStreamInfo(kTextTrackNum, "225K 275K 325K")); | 3703 MuxedStreamInfo(kTextTrackNum, "225K 275K 325K")); |
| 3701 | 3704 |
| 3702 message_loop_.RunUntilIdle(); | 3705 message_loop_.RunUntilIdle(); |
| 3703 EXPECT_TRUE(text_read_done); | 3706 EXPECT_TRUE(text_read_done); |
| 3704 | 3707 |
| 3705 // NOTE: we start at 275 here because the buffer at 225 was returned | 3708 // NOTE: we start at 275 here because the buffer at 225 was returned |
| 3706 // to the pending read initiated above. | 3709 // to the pending read initiated above. |
| 3707 CheckExpectedBuffers(text_stream, "275 325"); | 3710 CheckExpectedBuffers(text_stream, "275K 325K"); |
| 3708 | 3711 |
| 3709 // Verify that audio & video streams continue to return expected values. | 3712 // Verify that audio & video streams continue to return expected values. |
| 3710 CheckExpectedBuffers(audio_stream, "160 180"); | 3713 CheckExpectedBuffers(audio_stream, "160K 180K"); |
| 3711 CheckExpectedBuffers(video_stream, "180 210"); | 3714 CheckExpectedBuffers(video_stream, "180 210"); |
| 3712 } | 3715 } |
| 3713 | 3716 |
| 3714 TEST_F(ChunkDemuxerTest, ClusterWithUnknownSize) { | 3717 TEST_F(ChunkDemuxerTest, ClusterWithUnknownSize) { |
| 3715 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); | 3718 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); |
| 3716 | 3719 |
| 3717 AppendCluster(GenerateCluster(0, 0, 4, true)); | 3720 AppendCluster(GenerateCluster(0, 0, 4, true)); |
| 3718 CheckExpectedRanges(kSourceId, "{ [0,46) }"); | 3721 CheckExpectedRanges(kSourceId, "{ [0,46) }"); |
| 3719 | 3722 |
| 3720 // A new cluster indicates end of the previous cluster with unknown size. | 3723 // A new cluster indicates end of the previous cluster with unknown size. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3739 TEST_F(ChunkDemuxerTest, CuesBetweenClusters) { | 3742 TEST_F(ChunkDemuxerTest, CuesBetweenClusters) { |
| 3740 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); | 3743 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); |
| 3741 | 3744 |
| 3742 AppendCluster(GenerateCluster(0, 0, 4)); | 3745 AppendCluster(GenerateCluster(0, 0, 4)); |
| 3743 AppendData(kCuesHeader, sizeof(kCuesHeader)); | 3746 AppendData(kCuesHeader, sizeof(kCuesHeader)); |
| 3744 AppendCluster(GenerateCluster(46, 66, 5)); | 3747 AppendCluster(GenerateCluster(46, 66, 5)); |
| 3745 CheckExpectedRanges(kSourceId, "{ [0,115) }"); | 3748 CheckExpectedRanges(kSourceId, "{ [0,115) }"); |
| 3746 } | 3749 } |
| 3747 | 3750 |
| 3748 } // namespace media | 3751 } // namespace media |
| OLD | NEW |