| OLD | NEW |
| 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 "media/cast/sender/video_sender.h" | 5 #include "media/cast/sender/video_sender.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // |expect_init_success| is true if initialization is expected to succeed. | 179 // |expect_init_success| is true if initialization is expected to succeed. |
| 180 void InitEncoder(bool external, bool expect_init_success) { | 180 void InitEncoder(bool external, bool expect_init_success) { |
| 181 VideoSenderConfig video_config = GetDefaultVideoSenderConfig(); | 181 VideoSenderConfig video_config = GetDefaultVideoSenderConfig(); |
| 182 video_config.use_external_encoder = external; | 182 video_config.use_external_encoder = external; |
| 183 | 183 |
| 184 ASSERT_EQ(operational_status_, STATUS_UNINITIALIZED); | 184 ASSERT_EQ(operational_status_, STATUS_UNINITIALIZED); |
| 185 | 185 |
| 186 if (external) { | 186 if (external) { |
| 187 vea_factory_.SetInitializationWillSucceed(expect_init_success); | 187 vea_factory_.SetInitializationWillSucceed(expect_init_success); |
| 188 video_sender_.reset(new PeerVideoSender( | 188 video_sender_.reset(new PeerVideoSender( |
| 189 cast_environment_, | 189 cast_environment_, video_config, |
| 190 video_config, | |
| 191 base::Bind(&SaveOperationalStatus, &operational_status_), | 190 base::Bind(&SaveOperationalStatus, &operational_status_), |
| 192 base::Bind( | 191 base::Bind( |
| 193 &FakeVideoEncodeAcceleratorFactory::CreateVideoEncodeAccelerator, | 192 &FakeVideoEncodeAcceleratorFactory::CreateVideoEncodeAccelerator, |
| 194 base::Unretained(&vea_factory_)), | 193 base::Unretained(&vea_factory_)), |
| 195 base::Bind(&FakeVideoEncodeAcceleratorFactory::CreateSharedMemory, | 194 base::Bind(&FakeVideoEncodeAcceleratorFactory::CreateSharedMemory, |
| 196 base::Unretained(&vea_factory_)), | 195 base::Unretained(&vea_factory_)), |
| 197 transport_sender_.get())); | 196 transport_sender_.get())); |
| 198 } else { | 197 } else { |
| 199 video_sender_.reset(new PeerVideoSender( | 198 video_sender_.reset(new PeerVideoSender( |
| 200 cast_environment_, | 199 cast_environment_, video_config, |
| 201 video_config, | |
| 202 base::Bind(&SaveOperationalStatus, &operational_status_), | 200 base::Bind(&SaveOperationalStatus, &operational_status_), |
| 203 CreateDefaultVideoEncodeAcceleratorCallback(), | 201 CreateDefaultVideoEncodeAcceleratorCallback(), |
| 204 CreateDefaultVideoEncodeMemoryCallback(), | 202 CreateDefaultVideoEncodeMemoryCallback(), transport_sender_.get())); |
| 205 transport_sender_.get())); | |
| 206 } | 203 } |
| 207 task_runner_->RunTasks(); | 204 task_runner_->RunTasks(); |
| 208 } | 205 } |
| 209 | 206 |
| 210 scoped_refptr<media::VideoFrame> GetNewVideoFrame() { | 207 scoped_refptr<media::VideoFrame> GetNewVideoFrame() { |
| 211 if (first_frame_timestamp_.is_null()) | 208 if (first_frame_timestamp_.is_null()) |
| 212 first_frame_timestamp_ = testing_clock_->NowTicks(); | 209 first_frame_timestamp_ = testing_clock_->NowTicks(); |
| 213 gfx::Size size(kWidth, kHeight); | 210 gfx::Size size(kWidth, kHeight); |
| 214 scoped_refptr<media::VideoFrame> video_frame = | 211 scoped_refptr<media::VideoFrame> video_frame = |
| 215 media::VideoFrame::CreateFrame( | 212 media::VideoFrame::CreateFrame( |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 video_frame, | 635 video_frame, |
| 639 testing_clock_->NowTicks() + base::TimeDelta::FromMilliseconds(1000)); | 636 testing_clock_->NowTicks() + base::TimeDelta::FromMilliseconds(1000)); |
| 640 RunTasks(33); | 637 RunTasks(33); |
| 641 transport_->SetPause(false); | 638 transport_->SetPause(false); |
| 642 RunTasks(33); | 639 RunTasks(33); |
| 643 EXPECT_EQ(2, transport_->number_of_rtp_packets()); | 640 EXPECT_EQ(2, transport_->number_of_rtp_packets()); |
| 644 } | 641 } |
| 645 | 642 |
| 646 } // namespace cast | 643 } // namespace cast |
| 647 } // namespace media | 644 } // namespace media |
| OLD | NEW |