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

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

Issue 1905763002: Convert //media/cast from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « media/cast/receiver/video_decoder.cc ('k') | media/cast/sender/audio_encoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <cstdlib> 7 #include <cstdlib>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Prepare a simulated VideoFrame to feed into the VideoEncoder. 79 // Prepare a simulated VideoFrame to feed into the VideoEncoder.
80 const scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateFrame( 80 const scoped_refptr<VideoFrame> video_frame = VideoFrame::CreateFrame(
81 PIXEL_FORMAT_YV12, next_frame_size_, gfx::Rect(next_frame_size_), 81 PIXEL_FORMAT_YV12, next_frame_size_, gfx::Rect(next_frame_size_),
82 next_frame_size_, next_frame_timestamp_); 82 next_frame_size_, next_frame_timestamp_);
83 const base::TimeTicks reference_time = 83 const base::TimeTicks reference_time =
84 base::TimeTicks::UnixEpoch() + next_frame_timestamp_; 84 base::TimeTicks::UnixEpoch() + next_frame_timestamp_;
85 next_frame_timestamp_ += base::TimeDelta::FromSeconds(1) / kFrameRate; 85 next_frame_timestamp_ += base::TimeDelta::FromSeconds(1) / kFrameRate;
86 PopulateVideoFrame(video_frame.get(), 0); 86 PopulateVideoFrame(video_frame.get(), 0);
87 87
88 // Encode |frame| into |encoded_frame->data|. 88 // Encode |frame| into |encoded_frame->data|.
89 scoped_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame()); 89 std::unique_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame());
90 // Test only supports VP8, currently. 90 // Test only supports VP8, currently.
91 CHECK_EQ(CODEC_VIDEO_VP8, GetParam()); 91 CHECK_EQ(CODEC_VIDEO_VP8, GetParam());
92 vp8_encoder_.Encode(video_frame, reference_time, encoded_frame.get()); 92 vp8_encoder_.Encode(video_frame, reference_time, encoded_frame.get());
93 // Rewrite frame IDs for testing purposes. 93 // Rewrite frame IDs for testing purposes.
94 encoded_frame->frame_id = last_frame_id_ + 1 + num_dropped_frames; 94 encoded_frame->frame_id = last_frame_id_ + 1 + num_dropped_frames;
95 if (encoded_frame->dependency == EncodedFrame::KEY) 95 if (encoded_frame->dependency == EncodedFrame::KEY)
96 encoded_frame->referenced_frame_id = encoded_frame->frame_id; 96 encoded_frame->referenced_frame_id = encoded_frame->frame_id;
97 else 97 else
98 encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1; 98 encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1;
99 last_frame_id_ = encoded_frame->frame_id; 99 last_frame_id_ = encoded_frame->frame_id;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 EXPECT_LT(40.0, I420PSNR(expected_video_frame, video_frame)); 145 EXPECT_LT(40.0, I420PSNR(expected_video_frame, video_frame));
146 // TODO(miu): Once we start using VideoFrame::timestamp_, check that here. 146 // TODO(miu): Once we start using VideoFrame::timestamp_, check that here.
147 147
148 // Signal the main test thread that more video was decoded. 148 // Signal the main test thread that more video was decoded.
149 base::AutoLock auto_lock(lock_); 149 base::AutoLock auto_lock(lock_);
150 ++total_video_frames_decoded_; 150 ++total_video_frames_decoded_;
151 cond_.Signal(); 151 cond_.Signal();
152 } 152 }
153 153
154 const scoped_refptr<StandaloneCastEnvironment> cast_environment_; 154 const scoped_refptr<StandaloneCastEnvironment> cast_environment_;
155 scoped_ptr<VideoDecoder> video_decoder_; 155 std::unique_ptr<VideoDecoder> video_decoder_;
156 gfx::Size next_frame_size_; 156 gfx::Size next_frame_size_;
157 base::TimeDelta next_frame_timestamp_; 157 base::TimeDelta next_frame_timestamp_;
158 uint32_t last_frame_id_; 158 uint32_t last_frame_id_;
159 bool seen_a_decoded_frame_; 159 bool seen_a_decoded_frame_;
160 160
161 Vp8Encoder vp8_encoder_; 161 Vp8Encoder vp8_encoder_;
162 162
163 // Unlike |total_video_frames_decoded_|, this is only read/written on a single 163 // Unlike |total_video_frames_decoded_|, this is only read/written on a single
164 // thread. 164 // thread.
165 int total_video_frames_feed_in_; 165 int total_video_frames_feed_in_;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 WaitForAllVideoToBeDecoded(); 235 WaitForAllVideoToBeDecoded();
236 } 236 }
237 237
238 INSTANTIATE_TEST_CASE_P(, 238 INSTANTIATE_TEST_CASE_P(,
239 VideoDecoderTest, 239 VideoDecoderTest,
240 ::testing::Values(CODEC_VIDEO_VP8)); 240 ::testing::Values(CODEC_VIDEO_VP8));
241 241
242 } // namespace cast 242 } // namespace cast
243 } // namespace media 243 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/receiver/video_decoder.cc ('k') | media/cast/sender/audio_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698