OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 MediaStreamVideoSource::kMinHeight)); | 655 MediaStreamVideoSource::kMinHeight)); |
656 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( | 656 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( |
657 MediaStreamVideoSource::kMaxAspectRatio)); | 657 MediaStreamVideoSource::kMaxAspectRatio)); |
658 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( | 658 EXPECT_TRUE(MediaStreamVideoSource::IsConstraintSupported( |
659 MediaStreamVideoSource::kMinAspectRatio)); | 659 MediaStreamVideoSource::kMinAspectRatio)); |
660 | 660 |
661 EXPECT_FALSE(MediaStreamVideoSource::IsConstraintSupported( | 661 EXPECT_FALSE(MediaStreamVideoSource::IsConstraintSupported( |
662 "something unsupported")); | 662 "something unsupported")); |
663 } | 663 } |
664 | 664 |
| 665 // Test that the constraint negotiation can handle 0.0 fps as frame rate. |
| 666 TEST_F(MediaStreamVideoSourceTest, Use0FpsSupportedFormat) { |
| 667 media::VideoCaptureFormats formats; |
| 668 formats.push_back(media::VideoCaptureFormat( |
| 669 gfx::Size(640, 480), 0.0f, media::PIXEL_FORMAT_I420)); |
| 670 formats.push_back(media::VideoCaptureFormat( |
| 671 gfx::Size(320, 240), 0.0f, media::PIXEL_FORMAT_I420)); |
| 672 mock_source()->SetSupportedFormats(formats); |
| 673 |
| 674 blink::WebMediaConstraints constraints; |
| 675 constraints.initialize(); |
| 676 blink::WebMediaStreamTrack track = CreateTrack("123", constraints); |
| 677 mock_source()->CompleteGetSupportedFormats(); |
| 678 mock_source()->StartMockedSource(); |
| 679 EXPECT_EQ(1, NumberOfSuccessConstraintsCallbacks()); |
| 680 |
| 681 MockMediaStreamVideoSink sink; |
| 682 MediaStreamVideoSink::AddToVideoTrack( |
| 683 &sink, sink.GetDeliverFrameCB(), track); |
| 684 EXPECT_EQ(0, sink.number_of_frames()); |
| 685 DeliverVideoFrameAndWaitForRenderer(320, 240, &sink); |
| 686 EXPECT_EQ(1, sink.number_of_frames()); |
| 687 // Expect the delivered frame to be passed unchanged since its smaller than |
| 688 // max requested. |
| 689 EXPECT_EQ(320, sink.frame_size().width()); |
| 690 EXPECT_EQ(240, sink.frame_size().height()); |
| 691 MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track); |
| 692 } |
| 693 |
665 } // namespace content | 694 } // namespace content |
OLD | NEW |