Rename CaptureThread to EncodingThread.

Gives a less confusing name, this thread is used to pick up captured
frames and encode them.

BUG=
R=mflodman@webrtc.org

Review URL: https://codereview.webrtc.org/1332383002 .

Cr-Commit-Position: refs/heads/master@{#10010}
This commit is contained in:
Peter Boström 2015-09-22 11:14:17 +02:00
parent ef5d5e45cb
commit 7317248ea7
2 changed files with 16 additions and 21 deletions

View File

@ -40,10 +40,10 @@ VideoCaptureInput::VideoCaptureInput(ProcessThread* module_process_thread,
local_renderer_(local_renderer),
stats_proxy_(stats_proxy),
incoming_frame_cs_(CriticalSectionWrapper::CreateCriticalSection()),
capture_thread_(ThreadWrapper::CreateThread(CaptureThreadFunction,
encoder_thread_(ThreadWrapper::CreateThread(EncoderThreadFunction,
this,
"CaptureThread")),
capture_event_(*EventWrapper::Create()),
"EncoderThread")),
capture_event_(EventWrapper::Create()),
stop_(0),
last_captured_timestamp_(0),
delta_ntp_internal_ms_(
@ -53,8 +53,8 @@ VideoCaptureInput::VideoCaptureInput(ProcessThread* module_process_thread,
CpuOveruseOptions(),
overuse_observer,
stats_proxy)) {
capture_thread_->Start();
capture_thread_->SetPriority(kHighPriority);
encoder_thread_->Start();
encoder_thread_->SetPriority(kHighPriority);
module_process_thread_->RegisterModule(overuse_detector_.get());
}
@ -63,11 +63,8 @@ VideoCaptureInput::~VideoCaptureInput() {
// Stop the thread.
rtc::AtomicOps::ReleaseStore(&stop_, 1);
capture_event_.Set();
// Stop the camera input.
capture_thread_->Stop();
delete &capture_event_;
capture_event_->Set();
encoder_thread_->Stop();
}
void VideoCaptureInput::IncomingCapturedFrame(const VideoFrame& video_frame) {
@ -118,17 +115,17 @@ void VideoCaptureInput::IncomingCapturedFrame(const VideoFrame& video_frame) {
TRACE_EVENT_ASYNC_BEGIN1("webrtc", "Video", video_frame.render_time_ms(),
"render_time", video_frame.render_time_ms());
capture_event_.Set();
capture_event_->Set();
}
bool VideoCaptureInput::CaptureThreadFunction(void* obj) {
return static_cast<VideoCaptureInput*>(obj)->CaptureProcess();
bool VideoCaptureInput::EncoderThreadFunction(void* obj) {
return static_cast<VideoCaptureInput*>(obj)->EncoderProcess();
}
bool VideoCaptureInput::CaptureProcess() {
bool VideoCaptureInput::EncoderProcess() {
static const int kThreadWaitTimeMs = 100;
int64_t capture_time = -1;
if (capture_event_.Wait(kThreadWaitTimeMs) == kEventSignaled) {
if (capture_event_->Wait(kThreadWaitTimeMs) == kEventSignaled) {
if (rtc::AtomicOps::AcquireLoad(&stop_))
return false;

View File

@ -62,8 +62,8 @@ class VideoCaptureInput : public webrtc::VideoCaptureInput {
private:
// Thread functions for deliver captured frames to receivers.
static bool CaptureThreadFunction(void* obj);
bool CaptureProcess();
static bool EncoderThreadFunction(void* obj);
bool EncoderProcess();
void DeliverI420Frame(VideoFrame* video_frame);
@ -78,10 +78,8 @@ class VideoCaptureInput : public webrtc::VideoCaptureInput {
rtc::scoped_ptr<CriticalSectionWrapper> incoming_frame_cs_;
VideoFrame incoming_frame_;
// Capture thread.
rtc::scoped_ptr<ThreadWrapper> capture_thread_;
// TODO(pbos): scoped_ptr
EventWrapper& capture_event_;
rtc::scoped_ptr<ThreadWrapper> encoder_thread_;
rtc::scoped_ptr<EventWrapper> capture_event_;
volatile int stop_;