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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 DISALLOW_COPY_AND_ASSIGN(TestPacketSender); | 106 DISALLOW_COPY_AND_ASSIGN(TestPacketSender); |
107 }; | 107 }; |
108 | 108 |
109 void IgnorePlayoutDelayChanges(base::TimeDelta unused_playout_delay) { | 109 void IgnorePlayoutDelayChanges(base::TimeDelta unused_playout_delay) { |
110 } | 110 } |
111 | 111 |
112 class PeerVideoSender : public VideoSender { | 112 class PeerVideoSender : public VideoSender { |
113 public: | 113 public: |
114 PeerVideoSender( | 114 PeerVideoSender( |
115 scoped_refptr<CastEnvironment> cast_environment, | 115 scoped_refptr<CastEnvironment> cast_environment, |
116 const VideoSenderConfig& video_config, | 116 const FrameSenderConfig& video_config, |
117 const StatusChangeCallback& status_change_cb, | 117 const StatusChangeCallback& status_change_cb, |
118 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, | 118 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, |
119 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb, | 119 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb, |
120 CastTransport* const transport_sender) | 120 CastTransport* const transport_sender) |
121 : VideoSender(cast_environment, | 121 : VideoSender(cast_environment, |
122 video_config, | 122 video_config, |
123 status_change_cb, | 123 status_change_cb, |
124 create_vea_cb, | 124 create_vea_cb, |
125 create_video_encode_mem_cb, | 125 create_video_encode_mem_cb, |
126 transport_sender, | 126 transport_sender, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 ~VideoSenderTest() override {} | 171 ~VideoSenderTest() override {} |
172 | 172 |
173 void TearDown() final { | 173 void TearDown() final { |
174 video_sender_.reset(); | 174 video_sender_.reset(); |
175 task_runner_->RunTasks(); | 175 task_runner_->RunTasks(); |
176 } | 176 } |
177 | 177 |
178 // If |external| is true then external video encoder (VEA) is used. | 178 // If |external| is true then external video encoder (VEA) is used. |
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 FrameSenderConfig 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_, video_config, | 189 cast_environment_, video_config, |
190 base::Bind(&SaveOperationalStatus, &operational_status_), | 190 base::Bind(&SaveOperationalStatus, &operational_status_), |
191 base::Bind( | 191 base::Bind( |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 video_frame, | 635 video_frame, |
636 testing_clock_->NowTicks() + base::TimeDelta::FromMilliseconds(1000)); | 636 testing_clock_->NowTicks() + base::TimeDelta::FromMilliseconds(1000)); |
637 RunTasks(33); | 637 RunTasks(33); |
638 transport_->SetPause(false); | 638 transport_->SetPause(false); |
639 RunTasks(33); | 639 RunTasks(33); |
640 EXPECT_EQ(2, transport_->number_of_rtp_packets()); | 640 EXPECT_EQ(2, transport_->number_of_rtp_packets()); |
641 } | 641 } |
642 | 642 |
643 } // namespace cast | 643 } // namespace cast |
644 } // namespace media | 644 } // namespace media |
OLD | NEW |