| 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 "content/renderer/media/rtc_video_decoder.h" | 5 #include "content/renderer/media/rtc_video_decoder.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 const int RTCVideoDecoderTest::kWidth = 176; | 153 const int RTCVideoDecoderTest::kWidth = 176; |
| 154 const int RTCVideoDecoderTest::kHeight = 144; | 154 const int RTCVideoDecoderTest::kHeight = 144; |
| 155 const char* RTCVideoDecoderTest::kUrl = "media://remote/0"; | 155 const char* RTCVideoDecoderTest::kUrl = "media://remote/0"; |
| 156 const PipelineStatistics RTCVideoDecoderTest::kStatistics; | 156 const PipelineStatistics RTCVideoDecoderTest::kStatistics; |
| 157 | 157 |
| 158 TEST_F(RTCVideoDecoderTest, Initialize_Successful) { | 158 TEST_F(RTCVideoDecoderTest, Initialize_Successful) { |
| 159 InitializeDecoderSuccessfully(); | 159 InitializeDecoderSuccessfully(); |
| 160 | 160 |
| 161 // Test that the output media format is an uncompressed video surface that | 161 // Test that the output media format is an uncompressed video surface that |
| 162 // matches the dimensions specified by RTC. | 162 // matches the dimensions specified by RTC. |
| 163 EXPECT_EQ(kWidth, decoder_->width()); | 163 EXPECT_EQ(kWidth, decoder_->natural_size().width()); |
| 164 EXPECT_EQ(kHeight, decoder_->height()); | 164 EXPECT_EQ(kHeight, decoder_->natural_size().height()); |
| 165 } | 165 } |
| 166 | 166 |
| 167 TEST_F(RTCVideoDecoderTest, DoSeek) { | 167 TEST_F(RTCVideoDecoderTest, DoSeek) { |
| 168 const base::TimeDelta kZero; | 168 const base::TimeDelta kZero; |
| 169 | 169 |
| 170 InitializeDecoderSuccessfully(); | 170 InitializeDecoderSuccessfully(); |
| 171 | 171 |
| 172 decoder_->set_consume_video_frame_callback( | 172 decoder_->set_consume_video_frame_callback( |
| 173 base::Bind(&MockVideoRenderer::ConsumeVideoFrame, | 173 base::Bind(&MockVideoRenderer::ConsumeVideoFrame, |
| 174 base::Unretained(renderer_.get()))); | 174 base::Unretained(renderer_.get()))); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 208 |
| 209 message_loop_.RunAllPending(); | 209 message_loop_.RunAllPending(); |
| 210 EXPECT_EQ(RTCVideoDecoder::kNormal, decoder_->state_); | 210 EXPECT_EQ(RTCVideoDecoder::kNormal, decoder_->state_); |
| 211 } | 211 } |
| 212 | 212 |
| 213 TEST_F(RTCVideoDecoderTest, DoSetSize) { | 213 TEST_F(RTCVideoDecoderTest, DoSetSize) { |
| 214 InitializeDecoderSuccessfully(); | 214 InitializeDecoderSuccessfully(); |
| 215 | 215 |
| 216 int new_width = kWidth * 2; | 216 int new_width = kWidth * 2; |
| 217 int new_height = kHeight * 2; | 217 int new_height = kHeight * 2; |
| 218 gfx::Size new_natural_size(new_width, new_height); |
| 218 int new_reserved = 0; | 219 int new_reserved = 0; |
| 219 | 220 |
| 220 EXPECT_CALL(host_, | 221 EXPECT_CALL(host_, |
| 221 SetVideoSize(new_width, new_height)).WillRepeatedly(Return()); | 222 SetNaturalVideoSize(new_natural_size)).WillRepeatedly(Return()); |
| 222 | 223 |
| 223 decoder_->SetSize(new_width, new_height, new_reserved); | 224 decoder_->SetSize(new_width, new_height, new_reserved); |
| 224 | 225 |
| 225 EXPECT_EQ(new_width, decoder_->width()); | 226 EXPECT_EQ(new_width, decoder_->natural_size().width()); |
| 226 EXPECT_EQ(new_height, decoder_->height()); | 227 EXPECT_EQ(new_height, decoder_->natural_size().height()); |
| 227 | 228 |
| 228 message_loop_.RunAllPending(); | 229 message_loop_.RunAllPending(); |
| 229 } | 230 } |
| OLD | NEW |