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

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: IsRunning DCHECK 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 vie_sync_(vcm_), 104 vie_sync_(vcm_),
105 stats_observer_(new ChannelStatsObserver(this)), 105 stats_observer_(new ChannelStatsObserver(this)),
106 receive_stats_callback_(nullptr), 106 receive_stats_callback_(nullptr),
107 incoming_video_stream_(nullptr), 107 incoming_video_stream_(nullptr),
108 intra_frame_observer_(intra_frame_observer), 108 intra_frame_observer_(intra_frame_observer),
109 rtt_stats_(rtt_stats), 109 rtt_stats_(rtt_stats),
110 paced_sender_(paced_sender), 110 paced_sender_(paced_sender),
111 packet_router_(packet_router), 111 packet_router_(packet_router),
112 bandwidth_observer_(bandwidth_observer), 112 bandwidth_observer_(bandwidth_observer),
113 transport_feedback_observer_(transport_feedback_observer), 113 transport_feedback_observer_(transport_feedback_observer),
114 decode_thread_(ChannelDecodeThreadFunction, this, "DecodingThread"),
114 nack_history_size_sender_(kMinSendSidePacketHistorySize), 115 nack_history_size_sender_(kMinSendSidePacketHistorySize),
115 max_nack_reordering_threshold_(kMaxPacketAgeToNack), 116 max_nack_reordering_threshold_(kMaxPacketAgeToNack),
116 pre_render_callback_(NULL), 117 pre_render_callback_(NULL),
117 report_block_stats_sender_(new ReportBlockStats()), 118 report_block_stats_sender_(new ReportBlockStats()),
118 time_of_first_rtt_ms_(-1), 119 time_of_first_rtt_ms_(-1),
119 rtt_sum_ms_(0), 120 rtt_sum_ms_(0),
120 last_rtt_ms_(0), 121 last_rtt_ms_(0),
121 num_rtts_(0), 122 num_rtts_(0),
122 rtp_rtcp_modules_( 123 rtp_rtcp_modules_(
123 CreateRtpRtcpModules(!sender, 124 CreateRtpRtcpModules(!sender,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 vie_receiver_.GetReceiveStatistics()); 180 vie_receiver_.GetReceiveStatistics());
180 module_process_thread_->DeRegisterModule(vcm_); 181 module_process_thread_->DeRegisterModule(vcm_);
181 module_process_thread_->DeRegisterModule(&vie_sync_); 182 module_process_thread_->DeRegisterModule(&vie_sync_);
182 send_payload_router_->SetSendingRtpModules(std::list<RtpRtcp*>()); 183 send_payload_router_->SetSendingRtpModules(std::list<RtpRtcp*>());
183 for (size_t i = 0; i < num_active_rtp_rtcp_modules_; ++i) 184 for (size_t i = 0; i < num_active_rtp_rtcp_modules_; ++i)
184 packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i]); 185 packet_router_->RemoveRtpModule(rtp_rtcp_modules_[i]);
185 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { 186 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
186 module_process_thread_->DeRegisterModule(rtp_rtcp); 187 module_process_thread_->DeRegisterModule(rtp_rtcp);
187 delete rtp_rtcp; 188 delete rtp_rtcp;
188 } 189 }
189 if (decode_thread_) { 190 StopDecodeThread();
190 StopDecodeThread();
191 }
192 // Release modules. 191 // Release modules.
193 VideoCodingModule::Destroy(vcm_); 192 VideoCodingModule::Destroy(vcm_);
194 } 193 }
195 194
196 void ViEChannel::UpdateHistograms() { 195 void ViEChannel::UpdateHistograms() {
197 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds(); 196 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds();
198 197
199 { 198 {
200 CriticalSectionScoped cs(crit_.get()); 199 CriticalSectionScoped cs(crit_.get());
201 int64_t elapsed_sec = (now - time_of_first_rtt_ms_) / 1000; 200 int64_t elapsed_sec = (now - time_of_first_rtt_ms_) / 1000;
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 // Receive statistics and remote bitrate estimator should only be set for 1140 // Receive statistics and remote bitrate estimator should only be set for
1142 // the primary (first) module. 1141 // the primary (first) module.
1143 configuration.receive_statistics = null_receive_statistics; 1142 configuration.receive_statistics = null_receive_statistics;
1144 configuration.remote_bitrate_estimator = nullptr; 1143 configuration.remote_bitrate_estimator = nullptr;
1145 } 1144 }
1146 return modules; 1145 return modules;
1147 } 1146 }
1148 1147
1149 void ViEChannel::StartDecodeThread() { 1148 void ViEChannel::StartDecodeThread() {
1150 RTC_DCHECK(!sender_); 1149 RTC_DCHECK(!sender_);
1150 if (decode_thread_.IsRunning())
1151 return;
1151 // Start the decode thread 1152 // Start the decode thread
1152 if (decode_thread_) 1153 decode_thread_.Start();
1153 return; 1154 decode_thread_.SetPriority(rtc::kHighestPriority);
1154 decode_thread_ = PlatformThread::CreateThread(ChannelDecodeThreadFunction,
1155 this, "DecodingThread");
1156 decode_thread_->Start();
1157 decode_thread_->SetPriority(kHighestPriority);
1158 } 1155 }
1159 1156
1160 void ViEChannel::StopDecodeThread() { 1157 void ViEChannel::StopDecodeThread() {
1161 if (!decode_thread_)
1162 return;
1163
1164 vcm_->TriggerDecoderShutdown(); 1158 vcm_->TriggerDecoderShutdown();
1165 1159
1166 decode_thread_->Stop(); 1160 decode_thread_.Stop();
1167 decode_thread_.reset();
1168 } 1161 }
1169 1162
1170 int32_t ViEChannel::SetVoiceChannel(int32_t ve_channel_id, 1163 int32_t ViEChannel::SetVoiceChannel(int32_t ve_channel_id,
1171 VoEVideoSync* ve_sync_interface) { 1164 VoEVideoSync* ve_sync_interface) {
1172 return vie_sync_.ConfigureSync(ve_channel_id, ve_sync_interface, 1165 return vie_sync_.ConfigureSync(ve_channel_id, ve_sync_interface,
1173 rtp_rtcp_modules_[0], 1166 rtp_rtcp_modules_[0],
1174 vie_receiver_.GetRtpReceiver()); 1167 vie_receiver_.GetRtpReceiver());
1175 } 1168 }
1176 1169
1177 int32_t ViEChannel::VoiceChannel() { 1170 int32_t ViEChannel::VoiceChannel() {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 CriticalSectionScoped cs(crit_.get()); 1213 CriticalSectionScoped cs(crit_.get());
1221 receive_stats_callback_ = receive_statistics_proxy; 1214 receive_stats_callback_ = receive_statistics_proxy;
1222 } 1215 }
1223 1216
1224 void ViEChannel::SetIncomingVideoStream( 1217 void ViEChannel::SetIncomingVideoStream(
1225 IncomingVideoStream* incoming_video_stream) { 1218 IncomingVideoStream* incoming_video_stream) {
1226 CriticalSectionScoped cs(crit_.get()); 1219 CriticalSectionScoped cs(crit_.get());
1227 incoming_video_stream_ = incoming_video_stream; 1220 incoming_video_stream_ = incoming_video_stream;
1228 } 1221 }
1229 } // namespace webrtc 1222 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video_engine/vie_channel.h ('k') | webrtc/voice_engine/test/android/android_test/jni/android_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698