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

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

Issue 388663003: Cast: Reshuffle files under media/cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missing includes Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « media/cast/receiver/video_decoder.cc ('k') | media/cast/rtcp/mock_rtcp_receiver_feedback.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 <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"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "media/cast/cast_config.h" 12 #include "media/cast/cast_config.h"
13 #include "media/cast/receiver/video_decoder.h" 13 #include "media/cast/receiver/video_decoder.h"
14 #include "media/cast/sender/vp8_encoder.h"
14 #include "media/cast/test/utility/standalone_cast_environment.h" 15 #include "media/cast/test/utility/standalone_cast_environment.h"
15 #include "media/cast/test/utility/video_utility.h" 16 #include "media/cast/test/utility/video_utility.h"
16 #include "media/cast/video_sender/codecs/vp8/vp8_encoder.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 namespace media { 19 namespace media {
20 namespace cast { 20 namespace cast {
21 21
22 namespace { 22 namespace {
23 23
24 const int kWidth = 360; 24 const int kWidth = 360;
25 const int kHeight = 240; 25 const int kHeight = 240;
26 const int kFrameRate = 10; 26 const int kFrameRate = 10;
27 27
28 VideoSenderConfig GetVideoSenderConfigForTest() { 28 VideoSenderConfig GetVideoSenderConfigForTest() {
29 VideoSenderConfig config; 29 VideoSenderConfig config;
30 config.width = kWidth; 30 config.width = kWidth;
31 config.height = kHeight; 31 config.height = kHeight;
32 config.max_frame_rate = kFrameRate; 32 config.max_frame_rate = kFrameRate;
33 return config; 33 return config;
34 } 34 }
35 35
36 } // namespace 36 } // namespace
37 37
38 class VideoDecoderTest : public ::testing::TestWithParam<transport::Codec> { 38 class VideoDecoderTest : public ::testing::TestWithParam<Codec> {
39 public: 39 public:
40 VideoDecoderTest() 40 VideoDecoderTest()
41 : cast_environment_(new StandaloneCastEnvironment()), 41 : cast_environment_(new StandaloneCastEnvironment()),
42 vp8_encoder_(GetVideoSenderConfigForTest(), 0), 42 vp8_encoder_(GetVideoSenderConfigForTest(), 0),
43 cond_(&lock_) { 43 cond_(&lock_) {
44 vp8_encoder_.Initialize(); 44 vp8_encoder_.Initialize();
45 } 45 }
46 46
47 protected: 47 protected:
48 virtual void SetUp() OVERRIDE { 48 virtual void SetUp() OVERRIDE {
(...skipping 17 matching lines...) Expand all
66 const scoped_refptr<VideoFrame> video_frame = 66 const scoped_refptr<VideoFrame> video_frame =
67 VideoFrame::CreateFrame(VideoFrame::YV12, 67 VideoFrame::CreateFrame(VideoFrame::YV12,
68 frame_size, 68 frame_size,
69 gfx::Rect(frame_size), 69 gfx::Rect(frame_size),
70 frame_size, 70 frame_size,
71 next_frame_timestamp_); 71 next_frame_timestamp_);
72 next_frame_timestamp_ += base::TimeDelta::FromSeconds(1) / kFrameRate; 72 next_frame_timestamp_ += base::TimeDelta::FromSeconds(1) / kFrameRate;
73 PopulateVideoFrame(video_frame, 0); 73 PopulateVideoFrame(video_frame, 0);
74 74
75 // Encode |frame| into |encoded_frame->data|. 75 // Encode |frame| into |encoded_frame->data|.
76 scoped_ptr<transport::EncodedFrame> encoded_frame( 76 scoped_ptr<EncodedFrame> encoded_frame(
77 new transport::EncodedFrame()); 77 new EncodedFrame());
78 // Test only supports VP8, currently. 78 // Test only supports VP8, currently.
79 CHECK_EQ(transport::CODEC_VIDEO_VP8, GetParam()); 79 CHECK_EQ(CODEC_VIDEO_VP8, GetParam());
80 vp8_encoder_.Encode(video_frame, encoded_frame.get()); 80 vp8_encoder_.Encode(video_frame, encoded_frame.get());
81 encoded_frame->frame_id = last_frame_id_ + 1 + num_dropped_frames; 81 encoded_frame->frame_id = last_frame_id_ + 1 + num_dropped_frames;
82 last_frame_id_ = encoded_frame->frame_id; 82 last_frame_id_ = encoded_frame->frame_id;
83 83
84 { 84 {
85 base::AutoLock auto_lock(lock_); 85 base::AutoLock auto_lock(lock_);
86 ++total_video_frames_feed_in_; 86 ++total_video_frames_feed_in_;
87 } 87 }
88 88
89 cast_environment_->PostTask( 89 cast_environment_->PostTask(
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 FeedMoreVideo(num_dropped); 170 FeedMoreVideo(num_dropped);
171 } else { 171 } else {
172 FeedMoreVideo(0); 172 FeedMoreVideo(0);
173 } 173 }
174 } 174 }
175 WaitForAllVideoToBeDecoded(); 175 WaitForAllVideoToBeDecoded();
176 } 176 }
177 177
178 INSTANTIATE_TEST_CASE_P(VideoDecoderTestScenarios, 178 INSTANTIATE_TEST_CASE_P(VideoDecoderTestScenarios,
179 VideoDecoderTest, 179 VideoDecoderTest,
180 ::testing::Values(transport::CODEC_VIDEO_VP8)); 180 ::testing::Values(CODEC_VIDEO_VP8));
181 181
182 } // namespace cast 182 } // namespace cast
183 } // namespace media 183 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/receiver/video_decoder.cc ('k') | media/cast/rtcp/mock_rtcp_receiver_feedback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698