OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <deque> | 5 #include <deque> |
6 | 6 |
7 #include "base/threading/thread.h" | 7 #include "base/threading/thread.h" |
8 #include "media/base/filters.h" | 8 #include "media/base/filters.h" |
9 #include "media/base/mock_callback.h" | 9 #include "media/base/mock_callback.h" |
10 #include "media/base/mock_ffmpeg.h" | 10 #include "media/base/mock_ffmpeg.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 .WillOnce(Return(0)); | 418 .WillOnce(Return(0)); |
419 | 419 |
420 EXPECT_CALL(mock_ffmpeg_, CheckPoint(1)); | 420 EXPECT_CALL(mock_ffmpeg_, CheckPoint(1)); |
421 | 421 |
422 // ...then we'll expect a seek call... | 422 // ...then we'll expect a seek call... |
423 EXPECT_CALL(mock_ffmpeg_, | 423 EXPECT_CALL(mock_ffmpeg_, |
424 AVSeekFrame(&format_context_, -1, kExpectedTimestamp, kExpectedFlags)) | 424 AVSeekFrame(&format_context_, -1, kExpectedTimestamp, kExpectedFlags)) |
425 .WillOnce(Return(0)); | 425 .WillOnce(Return(0)); |
426 | 426 |
427 // ...then our callback will be executed... | 427 // ...then our callback will be executed... |
428 FilterCallback* seek_callback = NewExpectedCallback(); | 428 FilterStatusCB seek_cb = NewExpectedStatusCB(PIPELINE_OK); |
429 EXPECT_CALL(mock_ffmpeg_, CheckPoint(2)); | 429 EXPECT_CALL(mock_ffmpeg_, CheckPoint(2)); |
430 | 430 |
431 // ...followed by two audio packet reads we'll trigger... | 431 // ...followed by two audio packet reads we'll trigger... |
432 EXPECT_CALL(mock_ffmpeg_, AVReadFrame(&format_context_, _)) | 432 EXPECT_CALL(mock_ffmpeg_, AVReadFrame(&format_context_, _)) |
433 .WillOnce(CreatePacketNoCount(AV_STREAM_AUDIO, kAudioData, kDataSize)); | 433 .WillOnce(CreatePacketNoCount(AV_STREAM_AUDIO, kAudioData, kDataSize)); |
434 EXPECT_CALL(mock_ffmpeg_, AVDupPacket(_)) | 434 EXPECT_CALL(mock_ffmpeg_, AVDupPacket(_)) |
435 .WillOnce(Return(0)); | 435 .WillOnce(Return(0)); |
436 EXPECT_CALL(mock_ffmpeg_, AVReadFrame(&format_context_, _)) | 436 EXPECT_CALL(mock_ffmpeg_, AVReadFrame(&format_context_, _)) |
437 .WillOnce(CreatePacketNoCount(AV_STREAM_AUDIO, kAudioData, kDataSize)); | 437 .WillOnce(CreatePacketNoCount(AV_STREAM_AUDIO, kAudioData, kDataSize)); |
438 EXPECT_CALL(mock_ffmpeg_, AVDupPacket(_)) | 438 EXPECT_CALL(mock_ffmpeg_, AVDupPacket(_)) |
(...skipping 22 matching lines...) Expand all Loading... |
461 EXPECT_EQ(0, memcmp(kVideoData, reader->buffer()->GetData(), | 461 EXPECT_EQ(0, memcmp(kVideoData, reader->buffer()->GetData(), |
462 reader->buffer()->GetDataSize())); | 462 reader->buffer()->GetDataSize())); |
463 | 463 |
464 // Release the video packet and verify the other packets are still queued. | 464 // Release the video packet and verify the other packets are still queued. |
465 reader->Reset(); | 465 reader->Reset(); |
466 message_loop_.RunAllPending(); | 466 message_loop_.RunAllPending(); |
467 mock_ffmpeg_.CheckPoint(1); | 467 mock_ffmpeg_.CheckPoint(1); |
468 | 468 |
469 // Issue a simple forward seek, which should discard queued packets. | 469 // Issue a simple forward seek, which should discard queued packets. |
470 demuxer_->Seek(base::TimeDelta::FromMicroseconds(kExpectedTimestamp), | 470 demuxer_->Seek(base::TimeDelta::FromMicroseconds(kExpectedTimestamp), |
471 seek_callback); | 471 seek_cb); |
472 message_loop_.RunAllPending(); | 472 message_loop_.RunAllPending(); |
473 mock_ffmpeg_.CheckPoint(2); | 473 mock_ffmpeg_.CheckPoint(2); |
474 | 474 |
475 // Audio read #1. | 475 // Audio read #1. |
476 reader->Read(audio); | 476 reader->Read(audio); |
477 message_loop_.RunAllPending(); | 477 message_loop_.RunAllPending(); |
478 EXPECT_TRUE(reader->called()); | 478 EXPECT_TRUE(reader->called()); |
479 ASSERT_TRUE(reader->buffer()); | 479 ASSERT_TRUE(reader->buffer()); |
480 ASSERT_EQ(kDataSize, reader->buffer()->GetDataSize()); | 480 ASSERT_EQ(kDataSize, reader->buffer()->GetDataSize()); |
481 EXPECT_EQ(0, memcmp(kAudioData, reader->buffer()->GetData(), | 481 EXPECT_EQ(0, memcmp(kAudioData, reader->buffer()->GetData(), |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 { | 733 { |
734 SCOPED_TRACE(""); | 734 SCOPED_TRACE(""); |
735 InitializeDemuxer(); | 735 InitializeDemuxer(); |
736 } | 736 } |
737 EXPECT_CALL(*data_source_, IsStreaming()) | 737 EXPECT_CALL(*data_source_, IsStreaming()) |
738 .WillOnce(Return(false)); | 738 .WillOnce(Return(false)); |
739 EXPECT_FALSE(demuxer_->IsStreaming()); | 739 EXPECT_FALSE(demuxer_->IsStreaming()); |
740 } | 740 } |
741 | 741 |
742 } // namespace media | 742 } // namespace media |
OLD | NEW |