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

Side by Side Diff: media/cast/video_sender/external_video_encoder_unittest.cc

Issue 145443005: Fixes for memory and threading issues in cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile Created 6 years, 11 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
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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 video_config_.codec = transport::kVp8; 82 video_config_.codec = transport::kVp8;
83 gfx::Size size(video_config_.width, video_config_.height); 83 gfx::Size size(video_config_.width, video_config_.height);
84 video_frame_ = media::VideoFrame::CreateFrame(VideoFrame::I420, 84 video_frame_ = media::VideoFrame::CreateFrame(VideoFrame::I420,
85 size, gfx::Rect(size), size, base::TimeDelta()); 85 size, gfx::Rect(size), size, base::TimeDelta());
86 PopulateVideoFrame(video_frame_, 123); 86 PopulateVideoFrame(video_frame_, 123);
87 } 87 }
88 88
89 virtual ~ExternalVideoEncoderTest() {} 89 virtual ~ExternalVideoEncoderTest() {}
90 90
91 virtual void SetUp() { 91 virtual void SetUp() {
92 task_runner_ = new test::FakeTaskRunner(&testing_clock_); 92 testing_clock_ = new base::SimpleTestTickClock();
93 cast_environment_ = new CastEnvironment(&testing_clock_, task_runner_, 93 task_runner_ = new test::FakeTaskRunner(testing_clock_);
94 cast_environment_ = new CastEnvironment(
95 scoped_ptr<base::TickClock>(testing_clock_).Pass(), task_runner_,
94 task_runner_, task_runner_, task_runner_, task_runner_, task_runner_, 96 task_runner_, task_runner_, task_runner_, task_runner_, task_runner_,
95 GetDefaultCastSenderLoggingConfig()); 97 GetDefaultCastSenderLoggingConfig());
96 video_encoder_.reset(new ExternalVideoEncoder( 98 video_encoder_.reset(new ExternalVideoEncoder(
97 cast_environment_, 99 cast_environment_,
98 video_config_, 100 video_config_,
99 new test::FakeGpuVideoAcceleratorFactories(task_runner_))); 101 new test::FakeGpuVideoAcceleratorFactories(task_runner_)));
100 } 102 }
101 103
102 base::SimpleTestTickClock testing_clock_; 104 base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment.
103 scoped_refptr<TestVideoEncoderCallback> test_video_encoder_callback_; 105 scoped_refptr<TestVideoEncoderCallback> test_video_encoder_callback_;
104 VideoSenderConfig video_config_; 106 VideoSenderConfig video_config_;
105 scoped_refptr<test::FakeTaskRunner> task_runner_; 107 scoped_refptr<test::FakeTaskRunner> task_runner_;
106 scoped_ptr<VideoEncoder> video_encoder_; 108 scoped_ptr<VideoEncoder> video_encoder_;
107 scoped_refptr<media::VideoFrame> video_frame_; 109 scoped_refptr<media::VideoFrame> video_frame_;
108 scoped_refptr<CastEnvironment> cast_environment_; 110 scoped_refptr<CastEnvironment> cast_environment_;
109 }; 111 };
110 112
111 TEST_F(ExternalVideoEncoderTest, EncodePattern30fpsRunningOutOfAck) { 113 TEST_F(ExternalVideoEncoderTest, EncodePattern30fpsRunningOutOfAck) {
112 task_runner_->RunTasks(); // Run the initializer on the correct thread. 114 task_runner_->RunTasks(); // Run the initializer on the correct thread.
(...skipping 17 matching lines...) Expand all
130 frame_encoded_callback)); 132 frame_encoded_callback));
131 task_runner_->RunTasks(); 133 task_runner_->RunTasks();
132 } 134 }
133 // We need to run the task to cleanup the GPU instance. 135 // We need to run the task to cleanup the GPU instance.
134 video_encoder_.reset(NULL); 136 video_encoder_.reset(NULL);
135 task_runner_->RunTasks(); 137 task_runner_->RunTasks();
136 } 138 }
137 139
138 } // namespace cast 140 } // namespace cast
139 } // namespace media 141 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/video_receiver/video_receiver_unittest.cc ('k') | media/cast/video_sender/video_encoder_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698