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 #include <deque> | 6 #include <deque> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 DemuxerStream* video = demuxer_->GetStream(DemuxerStream::VIDEO); | 431 DemuxerStream* video = demuxer_->GetStream(DemuxerStream::VIDEO); |
432 DemuxerStream* audio = demuxer_->GetStream(DemuxerStream::AUDIO); | 432 DemuxerStream* audio = demuxer_->GetStream(DemuxerStream::AUDIO); |
433 | 433 |
434 const base::TimeDelta video_start_time = | 434 const base::TimeDelta video_start_time = |
435 base::TimeDelta::FromMicroseconds(400000); | 435 base::TimeDelta::FromMicroseconds(400000); |
436 const base::TimeDelta audio_start_time = | 436 const base::TimeDelta audio_start_time = |
437 base::TimeDelta::FromMicroseconds(396000); | 437 base::TimeDelta::FromMicroseconds(396000); |
438 | 438 |
439 // Run the test twice with a seek in between. | 439 // Run the test twice with a seek in between. |
440 for (int i = 0; i < 2; ++i) { | 440 for (int i = 0; i < 2; ++i) { |
441 // Check first buffer in video stream. It should have been adjusted such | 441 video->Read(NewReadCB(FROM_HERE, 5636, video_start_time.InMicroseconds())); |
442 // that it starts 400ms after the first audio buffer. | |
443 video->Read( | |
444 NewReadCB(FROM_HERE, | |
445 5636, | |
446 (video_start_time - audio_start_time).InMicroseconds())); | |
447 message_loop_.Run(); | 442 message_loop_.Run(); |
448 | 443 audio->Read(NewReadCB(FROM_HERE, 165, audio_start_time.InMicroseconds())); |
449 // Since the audio buffer has a lower first timestamp, it should become | |
450 // zero. | |
451 audio->Read(NewReadCB(FROM_HERE, 165, 0)); | |
452 message_loop_.Run(); | 444 message_loop_.Run(); |
453 | 445 |
454 // Verify that the start time is equal to the lowest timestamp (ie the | 446 // Verify that the start time is equal to the lowest timestamp (ie the |
455 // audio). | 447 // audio). |
456 EXPECT_EQ(audio_start_time, demuxer_->start_time()); | 448 EXPECT_EQ(audio_start_time, demuxer_->start_time()); |
457 | 449 |
458 // Verify that the timeline offset has been adjusted by the start time. | 450 // Verify that the timeline offset has been adjusted by the start time. |
459 EXPECT_EQ(kTimelineOffsetMs + audio_start_time.InMilliseconds(), | 451 EXPECT_EQ(kTimelineOffsetMs + audio_start_time.InMilliseconds(), |
460 demuxer_->GetTimelineOffset().ToJavaTime()); | 452 demuxer_->GetTimelineOffset().ToJavaTime()); |
461 | 453 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 InitializeDemuxer(); | 939 InitializeDemuxer(); |
948 | 940 |
949 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO); | 941 DemuxerStream* stream = demuxer_->GetStream(DemuxerStream::VIDEO); |
950 ASSERT_TRUE(stream); | 942 ASSERT_TRUE(stream); |
951 ASSERT_EQ(VIDEO_ROTATION_270, stream->video_rotation()); | 943 ASSERT_EQ(VIDEO_ROTATION_270, stream->video_rotation()); |
952 } | 944 } |
953 | 945 |
954 #endif | 946 #endif |
955 | 947 |
956 } // namespace media | 948 } // namespace media |
OLD | NEW |