Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: media/cast/sender/video_sender_unittest.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 12 matching lines...) Expand all
23 #include "media/cast/test/utility/default_config.h" 23 #include "media/cast/test/utility/default_config.h"
24 #include "media/cast/test/utility/video_utility.h" 24 #include "media/cast/test/utility/video_utility.h"
25 #include "media/video/fake_video_encode_accelerator.h" 25 #include "media/video/fake_video_encode_accelerator.h"
26 #include "testing/gmock/include/gmock/gmock.h" 26 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
28 28
29 namespace media { 29 namespace media {
30 namespace cast { 30 namespace cast {
31 31
32 namespace { 32 namespace {
33 static const uint8 kPixelValue = 123; 33 static const uint8_t kPixelValue = 123;
34 static const int kWidth = 320; 34 static const int kWidth = 320;
35 static const int kHeight = 240; 35 static const int kHeight = 240;
36 36
37 using testing::_; 37 using testing::_;
38 using testing::AtLeast; 38 using testing::AtLeast;
39 39
40 40
41 void SaveOperationalStatus(OperationalStatus* out_status, 41 void SaveOperationalStatus(OperationalStatus* out_status,
42 OperationalStatus in_status) { 42 OperationalStatus in_status) {
43 DVLOG(1) << "OperationalStatus transitioning from " << *out_status << " to " 43 DVLOG(1) << "OperationalStatus transitioning from " << *out_status << " to "
(...skipping 22 matching lines...) Expand all
66 // packet. This confirms that the receiver will have the necessary lip 66 // packet. This confirms that the receiver will have the necessary lip
67 // sync info before it has to calculate the playout time of the first 67 // sync info before it has to calculate the playout time of the first
68 // frame. 68 // frame.
69 if (number_of_rtp_packets_ == 0) 69 if (number_of_rtp_packets_ == 0)
70 EXPECT_LE(1, number_of_rtcp_packets_); 70 EXPECT_LE(1, number_of_rtcp_packets_);
71 ++number_of_rtp_packets_; 71 ++number_of_rtp_packets_;
72 } 72 }
73 return true; 73 return true;
74 } 74 }
75 75
76 int64 GetBytesSent() final { return 0; } 76 int64_t GetBytesSent() final { return 0; }
77 77
78 int number_of_rtp_packets() const { return number_of_rtp_packets_; } 78 int number_of_rtp_packets() const { return number_of_rtp_packets_; }
79 79
80 int number_of_rtcp_packets() const { return number_of_rtcp_packets_; } 80 int number_of_rtcp_packets() const { return number_of_rtcp_packets_; }
81 81
82 void SetPause(bool paused) { 82 void SetPause(bool paused) {
83 paused_ = paused; 83 paused_ = paused;
84 if (!paused && stored_packet_.get()) { 84 if (!paused && stored_packet_.get()) {
85 SendPacket(stored_packet_, callback_); 85 SendPacket(stored_packet_, callback_);
86 callback_.Run(); 86 callback_.Run();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 using VideoSender::OnReceivedCastFeedback; 119 using VideoSender::OnReceivedCastFeedback;
120 using VideoSender::GetMaximumTargetBitrateForFrame; 120 using VideoSender::GetMaximumTargetBitrateForFrame;
121 }; 121 };
122 122
123 // Creates a VideoFrame NOT backed by actual memory storage. The frame's 123 // Creates a VideoFrame NOT backed by actual memory storage. The frame's
124 // metadata (i.e., size and frame duration) are all that are needed to test the 124 // metadata (i.e., size and frame duration) are all that are needed to test the
125 // GetMaximumTargetBitrateForFrame() logic. 125 // GetMaximumTargetBitrateForFrame() logic.
126 scoped_refptr<VideoFrame> CreateFakeFrame(const gfx::Size& resolution, 126 scoped_refptr<VideoFrame> CreateFakeFrame(const gfx::Size& resolution,
127 bool high_frame_rate_in_metadata) { 127 bool high_frame_rate_in_metadata) {
128 const scoped_refptr<VideoFrame> frame = VideoFrame::WrapExternalData( 128 const scoped_refptr<VideoFrame> frame = VideoFrame::WrapExternalData(
129 PIXEL_FORMAT_I420, 129 PIXEL_FORMAT_I420, resolution, gfx::Rect(resolution), resolution,
130 resolution, 130 static_cast<uint8_t*>(nullptr) + 1, resolution.GetArea() * 3 / 2,
131 gfx::Rect(resolution),
132 resolution,
133 static_cast<uint8*>(nullptr) + 1,
134 resolution.GetArea() * 3 / 2,
135 base::TimeDelta()); 131 base::TimeDelta());
136 const double frame_rate = high_frame_rate_in_metadata ? 60.0 : 30.0; 132 const double frame_rate = high_frame_rate_in_metadata ? 60.0 : 30.0;
137 frame->metadata()->SetTimeDelta( 133 frame->metadata()->SetTimeDelta(
138 VideoFrameMetadata::FRAME_DURATION, 134 VideoFrameMetadata::FRAME_DURATION,
139 base::TimeDelta::FromSecondsD(1.0 / frame_rate)); 135 base::TimeDelta::FromSecondsD(1.0 / frame_rate));
140 return frame; 136 return frame;
141 } 137 }
142 138
143 } // namespace 139 } // namespace
144 140
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 << ", hfr=" << kTestCases[i].high_frame_rate); 654 << ", hfr=" << kTestCases[i].high_frame_rate);
659 const scoped_refptr<VideoFrame> frame = 655 const scoped_refptr<VideoFrame> frame =
660 CreateFakeFrame(resolution, kTestCases[i].high_frame_rate); 656 CreateFakeFrame(resolution, kTestCases[i].high_frame_rate);
661 EXPECT_EQ(kTestCases[i].expected_bitrate, 657 EXPECT_EQ(kTestCases[i].expected_bitrate,
662 PeerVideoSender::GetMaximumTargetBitrateForFrame(*frame)); 658 PeerVideoSender::GetMaximumTargetBitrateForFrame(*frame));
663 } 659 }
664 } 660 }
665 661
666 } // namespace cast 662 } // namespace cast
667 } // namespace media 663 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698