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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 decoder3_ = NULL; | 111 decoder3_ = NULL; |
112 video_frame_stream_.reset(); | 112 video_frame_stream_.reset(); |
113 base::RunLoop().RunUntilIdle(); | 113 base::RunLoop().RunUntilIdle(); |
114 | 114 |
115 DCHECK(!pending_initialize_); | 115 DCHECK(!pending_initialize_); |
116 DCHECK(!pending_read_); | 116 DCHECK(!pending_read_); |
117 DCHECK(!pending_reset_); | 117 DCHECK(!pending_reset_); |
118 DCHECK(!pending_stop_); | 118 DCHECK(!pending_stop_); |
119 } | 119 } |
120 | 120 |
121 MOCK_METHOD1(OnNewSpliceBuffer, void(base::TimeDelta)); | |
122 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); | 121 MOCK_METHOD0(OnWaitingForDecryptionKey, void(void)); |
123 | 122 |
124 void OnStatistics(const PipelineStatistics& statistics) { | 123 void OnStatistics(const PipelineStatistics& statistics) { |
125 num_decoded_bytes_unreported_ -= statistics.video_bytes_decoded; | 124 num_decoded_bytes_unreported_ -= statistics.video_bytes_decoded; |
126 } | 125 } |
127 | 126 |
128 void OnBytesDecoded(int count) { | 127 void OnBytesDecoded(int count) { |
129 num_decoded_bytes_unreported_ += count; | 128 num_decoded_bytes_unreported_ += count; |
130 } | 129 } |
131 | 130 |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 Read(); | 612 Read(); |
614 } | 613 } |
615 | 614 |
616 TEST_P(VideoFrameStreamTest, Reset_AfterNormalRead) { | 615 TEST_P(VideoFrameStreamTest, Reset_AfterNormalRead) { |
617 Initialize(); | 616 Initialize(); |
618 Read(); | 617 Read(); |
619 Reset(); | 618 Reset(); |
620 Read(); | 619 Read(); |
621 } | 620 } |
622 | 621 |
623 TEST_P(VideoFrameStreamTest, Reset_AfterNormalReadWithActiveSplice) { | |
624 video_frame_stream_->set_splice_observer(base::Bind( | |
625 &VideoFrameStreamTest::OnNewSpliceBuffer, base::Unretained(this))); | |
626 Initialize(); | |
627 | |
628 // Send buffers with a splice timestamp, which sets the active splice flag. | |
629 const base::TimeDelta splice_timestamp = base::TimeDelta(); | |
630 demuxer_stream_->set_splice_timestamp(splice_timestamp); | |
631 EXPECT_CALL(*this, OnNewSpliceBuffer(splice_timestamp)).Times(AnyNumber()); | |
632 Read(); | |
633 | |
634 // Issue an explicit Reset() and clear the splice timestamp. | |
635 Reset(); | |
636 demuxer_stream_->set_splice_timestamp(kNoTimestamp); | |
637 | |
638 // Ensure none of the upcoming calls indicate they have a splice timestamp. | |
639 EXPECT_CALL(*this, OnNewSpliceBuffer(_)).Times(0); | |
640 Read(); | |
641 } | |
642 | |
643 TEST_P(VideoFrameStreamTest, Reset_AfterDemuxerRead_ConfigChange) { | 622 TEST_P(VideoFrameStreamTest, Reset_AfterDemuxerRead_ConfigChange) { |
644 Initialize(); | 623 Initialize(); |
645 EnterPendingState(DEMUXER_READ_CONFIG_CHANGE); | 624 EnterPendingState(DEMUXER_READ_CONFIG_CHANGE); |
646 SatisfyPendingCallback(DEMUXER_READ_CONFIG_CHANGE); | 625 SatisfyPendingCallback(DEMUXER_READ_CONFIG_CHANGE); |
647 Reset(); | 626 Reset(); |
648 Read(); | 627 Read(); |
649 } | 628 } |
650 | 629 |
651 TEST_P(VideoFrameStreamTest, Reset_AfterEndOfStream) { | 630 TEST_P(VideoFrameStreamTest, Reset_AfterEndOfStream) { |
652 Initialize(); | 631 Initialize(); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 | 1106 |
1128 TEST_P(VideoFrameStreamTest, Destroy_DuringFallbackDecoderSelection) { | 1107 TEST_P(VideoFrameStreamTest, Destroy_DuringFallbackDecoderSelection) { |
1129 Initialize(); | 1108 Initialize(); |
1130 decoder1_->SimulateFailureToInit(); | 1109 decoder1_->SimulateFailureToInit(); |
1131 EnterPendingState(DECODER_REINIT); | 1110 EnterPendingState(DECODER_REINIT); |
1132 decoder2_->HoldNextInit(); | 1111 decoder2_->HoldNextInit(); |
1133 SatisfyPendingCallback(DECODER_REINIT); | 1112 SatisfyPendingCallback(DECODER_REINIT); |
1134 } | 1113 } |
1135 | 1114 |
1136 } // namespace media | 1115 } // namespace media |
OLD | NEW |