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

Side by Side Diff: webrtc/video_engine/vie_channel.cc

Issue 1476453002: Clean up PlatformThread. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: hopefully the last win compile error Created 5 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 vie_sync_(vcm_), 103 vie_sync_(vcm_),
104 stats_observer_(new ChannelStatsObserver(this)), 104 stats_observer_(new ChannelStatsObserver(this)),
105 receive_stats_callback_(nullptr), 105 receive_stats_callback_(nullptr),
106 incoming_video_stream_(nullptr), 106 incoming_video_stream_(nullptr),
107 intra_frame_observer_(intra_frame_observer), 107 intra_frame_observer_(intra_frame_observer),
108 rtt_stats_(rtt_stats), 108 rtt_stats_(rtt_stats),
109 paced_sender_(paced_sender), 109 paced_sender_(paced_sender),
110 packet_router_(packet_router), 110 packet_router_(packet_router),
111 bandwidth_observer_(bandwidth_observer), 111 bandwidth_observer_(bandwidth_observer),
112 transport_feedback_observer_(transport_feedback_observer), 112 transport_feedback_observer_(transport_feedback_observer),
113 decode_thread_(ChannelDecodeThreadFunction, this, "DecodingThread"),
113 nack_history_size_sender_(kMinSendSidePacketHistorySize), 114 nack_history_size_sender_(kMinSendSidePacketHistorySize),
114 max_nack_reordering_threshold_(kMaxPacketAgeToNack), 115 max_nack_reordering_threshold_(kMaxPacketAgeToNack),
115 pre_render_callback_(NULL), 116 pre_render_callback_(NULL),
116 report_block_stats_sender_(new ReportBlockStats()), 117 report_block_stats_sender_(new ReportBlockStats()),
117 time_of_first_rtt_ms_(-1), 118 time_of_first_rtt_ms_(-1),
118 rtt_sum_ms_(0), 119 rtt_sum_ms_(0),
119 last_rtt_ms_(0), 120 last_rtt_ms_(0),
120 num_rtts_(0), 121 num_rtts_(0),
121 rtp_rtcp_modules_( 122 rtp_rtcp_modules_(
122 CreateRtpRtcpModules(!sender, 123 CreateRtpRtcpModules(!sender,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 vie_receiver_.GetReceiveStatistics()); 179 vie_receiver_.GetReceiveStatistics());
179 module_process_thread_->DeRegisterModule(vcm_); 180 module_process_thread_->DeRegisterModule(vcm_);
180 module_process_thread_->DeRegisterModule(&vie_sync_); 181 module_process_thread_->DeRegisterModule(&vie_sync_);
181 send_payload_router_->SetSendingRtpModules(std::list<RtpRtcp*>()); 182 send_payload_router_->SetSendingRtpModules(std::list<RtpRtcp*>());
182 for (size_t i = 0; i < num_active_rtp_rtcp_modules_; ++i) 183 for (size_t i = 0; i < num_active_rtp_rtcp_modules_; ++i)
183 packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i]); 184 packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i]);
184 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 185 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
185 module_process_thread_->DeRegisterModule(rtp_rtcp); 186 module_process_thread_->DeRegisterModule(rtp_rtcp);
186 delete rtp_rtcp; 187 delete rtp_rtcp;
187 } 188 }
188 if (decode_thread_) { 189 StopDecodeThread();
189 StopDecodeThread();
190 }
191 // Release modules. 190 // Release modules.
192 VideoCodingModule::Destroy(vcm_); 191 VideoCodingModule::Destroy(vcm_);
193 } 192 }
194 193
195 void ViEChannel::UpdateHistograms() { 194 void ViEChannel::UpdateHistograms() {
196 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds(); 195 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds();
197 196
198 { 197 {
199 CriticalSectionScoped cs(crit_.get()); 198 CriticalSectionScoped cs(crit_.get());
200 int64_t elapsed_sec = (now - time_of_first_rtt_ms_) / 1000; 199 int64_t elapsed_sec = (now - time_of_first_rtt_ms_) / 1000;
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 // Receive statistics and remote bitrate estimator should only be set for 1139 // Receive statistics and remote bitrate estimator should only be set for
1141 // the primary (first) module. 1140 // the primary (first) module.
1142 configuration.receive_statistics = null_receive_statistics; 1141 configuration.receive_statistics = null_receive_statistics;
1143 configuration.remote_bitrate_estimator = nullptr; 1142 configuration.remote_bitrate_estimator = nullptr;
1144 } 1143 }
1145 return modules; 1144 return modules;
1146 } 1145 }
1147 1146
1148 void ViEChannel::StartDecodeThread() { 1147 void ViEChannel::StartDecodeThread() {
1149 RTC_DCHECK(!sender_); 1148 RTC_DCHECK(!sender_);
1149 if (decode_thread_.IsRunning())
1150 return;
1150 // Start the decode thread 1151 // Start the decode thread
1151 if (decode_thread_) 1152 decode_thread_.Start();
1152 return; 1153 decode_thread_.SetPriority(rtc::kHighestPriority);
1153 decode_thread_ = PlatformThread::CreateThread(ChannelDecodeThreadFunction,
1154 this, "DecodingThread");
1155 decode_thread_->Start();
1156 decode_thread_->SetPriority(kHighestPriority);
1157 } 1154 }
1158 1155
1159 void ViEChannel::StopDecodeThread() { 1156 void ViEChannel::StopDecodeThread() {
1160 if (!decode_thread_)
1161 return;
1162
1163 vcm_->TriggerDecoderShutdown(); 1157 vcm_->TriggerDecoderShutdown();
1164 1158
1165 decode_thread_->Stop(); 1159 decode_thread_.Stop();
1166 decode_thread_.reset();
1167 } 1160 }
1168 1161
1169 int32_t ViEChannel::SetVoiceChannel(int32_t ve_channel_id, 1162 int32_t ViEChannel::SetVoiceChannel(int32_t ve_channel_id,
1170 VoEVideoSync* ve_sync_interface) { 1163 VoEVideoSync* ve_sync_interface) {
1171 return vie_sync_.ConfigureSync(ve_channel_id, ve_sync_interface, 1164 return vie_sync_.ConfigureSync(ve_channel_id, ve_sync_interface,
1172 rtp_rtcp_modules_[0], 1165 rtp_rtcp_modules_[0],
1173 vie_receiver_.GetRtpReceiver()); 1166 vie_receiver_.GetRtpReceiver());
1174 } 1167 }
1175 1168
1176 int32_t ViEChannel::VoiceChannel() { 1169 int32_t ViEChannel::VoiceChannel() {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 CriticalSectionScoped cs(crit_.get()); 1212 CriticalSectionScoped cs(crit_.get());
1220 receive_stats_callback_ = receive_statistics_proxy; 1213 receive_stats_callback_ = receive_statistics_proxy;
1221 } 1214 }
1222 1215
1223 void ViEChannel::SetIncomingVideoStream( 1216 void ViEChannel::SetIncomingVideoStream(
1224 IncomingVideoStream* incoming_video_stream) { 1217 IncomingVideoStream* incoming_video_stream) {
1225 CriticalSectionScoped cs(crit_.get()); 1218 CriticalSectionScoped cs(crit_.get());
1226 incoming_video_stream_ = incoming_video_stream; 1219 incoming_video_stream_ = incoming_video_stream;
1227 } 1220 }
1228 } // namespace webrtc 1221 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698