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

Side by Side Diff: media/cast/receiver/video_decoder_unittest.cc

Issue 506683002: Remove implicit conversions from scoped_refptr to T* in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 <cstdlib> 5 #include <cstdlib>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/synchronization/condition_variable.h" 9 #include "base/synchronization/condition_variable.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Prepare a simulated EncodedFrame to feed into the VideoDecoder. 68 // Prepare a simulated EncodedFrame to feed into the VideoDecoder.
69 69
70 const gfx::Size frame_size(kWidth, kHeight); 70 const gfx::Size frame_size(kWidth, kHeight);
71 const scoped_refptr<VideoFrame> video_frame = 71 const scoped_refptr<VideoFrame> video_frame =
72 VideoFrame::CreateFrame(VideoFrame::YV12, 72 VideoFrame::CreateFrame(VideoFrame::YV12,
73 frame_size, 73 frame_size,
74 gfx::Rect(frame_size), 74 gfx::Rect(frame_size),
75 frame_size, 75 frame_size,
76 next_frame_timestamp_); 76 next_frame_timestamp_);
77 next_frame_timestamp_ += base::TimeDelta::FromSeconds(1) / kFrameRate; 77 next_frame_timestamp_ += base::TimeDelta::FromSeconds(1) / kFrameRate;
78 PopulateVideoFrame(video_frame, 0); 78 PopulateVideoFrame(video_frame.get(), 0);
79 79
80 // Encode |frame| into |encoded_frame->data|. 80 // Encode |frame| into |encoded_frame->data|.
81 scoped_ptr<EncodedFrame> encoded_frame( 81 scoped_ptr<EncodedFrame> encoded_frame(
82 new EncodedFrame()); 82 new EncodedFrame());
83 // Test only supports VP8, currently. 83 // Test only supports VP8, currently.
84 CHECK_EQ(CODEC_VIDEO_VP8, GetParam()); 84 CHECK_EQ(CODEC_VIDEO_VP8, GetParam());
85 vp8_encoder_.Encode(video_frame, encoded_frame.get()); 85 vp8_encoder_.Encode(video_frame, encoded_frame.get());
86 encoded_frame->frame_id = last_frame_id_ + 1 + num_dropped_frames; 86 encoded_frame->frame_id = last_frame_id_ + 1 + num_dropped_frames;
87 last_frame_id_ = encoded_frame->frame_id; 87 last_frame_id_ = encoded_frame->frame_id;
88 88
(...skipping 25 matching lines...) Expand all
114 114
115 private: 115 private:
116 // Called by |vp8_decoder_| to deliver each frame of decoded video. 116 // Called by |vp8_decoder_| to deliver each frame of decoded video.
117 void OnDecodedFrame(const scoped_refptr<VideoFrame>& expected_video_frame, 117 void OnDecodedFrame(const scoped_refptr<VideoFrame>& expected_video_frame,
118 bool should_be_continuous, 118 bool should_be_continuous,
119 const scoped_refptr<VideoFrame>& video_frame, 119 const scoped_refptr<VideoFrame>& video_frame,
120 bool is_continuous) { 120 bool is_continuous) {
121 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 121 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
122 122
123 // A NULL |video_frame| indicates a decode error, which we don't expect. 123 // A NULL |video_frame| indicates a decode error, which we don't expect.
124 ASSERT_FALSE(!video_frame); 124 ASSERT_FALSE(!video_frame.get());
125 125
126 // Did the decoder detect whether frames were dropped? 126 // Did the decoder detect whether frames were dropped?
127 EXPECT_EQ(should_be_continuous, is_continuous); 127 EXPECT_EQ(should_be_continuous, is_continuous);
128 128
129 // Does the video data seem to be intact? 129 // Does the video data seem to be intact?
130 EXPECT_EQ(expected_video_frame->coded_size().width(), 130 EXPECT_EQ(expected_video_frame->coded_size().width(),
131 video_frame->coded_size().width()); 131 video_frame->coded_size().width());
132 EXPECT_EQ(expected_video_frame->coded_size().height(), 132 EXPECT_EQ(expected_video_frame->coded_size().height(),
133 video_frame->coded_size().height()); 133 video_frame->coded_size().height());
134 EXPECT_LT(40.0, I420PSNR(expected_video_frame, video_frame)); 134 EXPECT_LT(40.0, I420PSNR(expected_video_frame, video_frame));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 WaitForAllVideoToBeDecoded(); 180 WaitForAllVideoToBeDecoded();
181 } 181 }
182 182
183 INSTANTIATE_TEST_CASE_P(VideoDecoderTestScenarios, 183 INSTANTIATE_TEST_CASE_P(VideoDecoderTestScenarios,
184 VideoDecoderTest, 184 VideoDecoderTest,
185 ::testing::Values(CODEC_VIDEO_VP8)); 185 ::testing::Values(CODEC_VIDEO_VP8));
186 186
187 } // namespace cast 187 } // namespace cast
188 } // namespace media 188 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698