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

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

Issue 1476523005: Verify returned frames from media::VideoFrame::Wrap*() methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: LOG in video_Frame and CHECK/return outside. 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
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,
130 resolution, 130 resolution,
131 gfx::Rect(resolution), 131 gfx::Rect(resolution),
132 resolution, 132 resolution,
133 static_cast<uint8*>(nullptr) + 1, 133 static_cast<uint8*>(nullptr) + 1,
134 resolution.GetArea() * 3 / 2, 134 resolution.GetArea() * 3 / 2,
135 base::TimeDelta()); 135 base::TimeDelta());
136 CHECK(frame);
136 const double frame_rate = high_frame_rate_in_metadata ? 60.0 : 30.0; 137 const double frame_rate = high_frame_rate_in_metadata ? 60.0 : 30.0;
137 frame->metadata()->SetTimeDelta( 138 frame->metadata()->SetTimeDelta(
138 VideoFrameMetadata::FRAME_DURATION, 139 VideoFrameMetadata::FRAME_DURATION,
139 base::TimeDelta::FromSecondsD(1.0 / frame_rate)); 140 base::TimeDelta::FromSecondsD(1.0 / frame_rate));
140 return frame; 141 return frame;
141 } 142 }
142 143
143 } // namespace 144 } // namespace
144 145
145 class VideoSenderTest : public ::testing::Test { 146 class VideoSenderTest : public ::testing::Test {
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 << ", hfr=" << kTestCases[i].high_frame_rate); 659 << ", hfr=" << kTestCases[i].high_frame_rate);
659 const scoped_refptr<VideoFrame> frame = 660 const scoped_refptr<VideoFrame> frame =
660 CreateFakeFrame(resolution, kTestCases[i].high_frame_rate); 661 CreateFakeFrame(resolution, kTestCases[i].high_frame_rate);
661 EXPECT_EQ(kTestCases[i].expected_bitrate, 662 EXPECT_EQ(kTestCases[i].expected_bitrate,
662 PeerVideoSender::GetMaximumTargetBitrateForFrame(*frame)); 663 PeerVideoSender::GetMaximumTargetBitrateForFrame(*frame));
663 } 664 }
664 } 665 }
665 666
666 } // namespace cast 667 } // namespace cast
667 } // namespace media 668 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698