Delete some dead code in vcm::VideoReceiver and VCMReceiver

Bug: None
Change-Id: I9cb8bd57af697762a9fc76007e139695afaf1fa4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152381
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29134}
This commit is contained in:
Niels Möller
2019-09-10 13:02:28 +02:00
committed by Commit Bot
parent fe407b7a1d
commit 45b01c7962
5 changed files with 5 additions and 89 deletions

View File

@ -46,22 +46,13 @@ VCMReceiver::VCMReceiver(VCMTiming* timing,
timing_(timing), timing_(timing),
render_wait_event_(std::move(receiver_event)), render_wait_event_(std::move(receiver_event)),
max_video_delay_ms_(kMaxVideoDelayMs) { max_video_delay_ms_(kMaxVideoDelayMs) {
Reset(); jitter_buffer_.Start();
} }
VCMReceiver::~VCMReceiver() { VCMReceiver::~VCMReceiver() {
render_wait_event_->Set(); render_wait_event_->Set();
} }
void VCMReceiver::Reset() {
rtc::CritScope cs(&crit_sect_);
if (!jitter_buffer_.Running()) {
jitter_buffer_.Start();
} else {
jitter_buffer_.Flush();
}
}
int32_t VCMReceiver::InsertPacket(const VCMPacket& packet) { int32_t VCMReceiver::InsertPacket(const VCMPacket& packet) {
// Insert the packet into the jitter buffer. The packet can either be empty or // Insert the packet into the jitter buffer. The packet can either be empty or
// contain media at this point. // contain media at this point.
@ -84,11 +75,6 @@ int32_t VCMReceiver::InsertPacket(const VCMPacket& packet) {
return VCM_OK; return VCM_OK;
} }
void VCMReceiver::TriggerDecoderShutdown() {
jitter_buffer_.Stop();
render_wait_event_->Set();
}
VCMEncodedFrame* VCMReceiver::FrameForDecoding(uint16_t max_wait_time_ms, VCMEncodedFrame* VCMReceiver::FrameForDecoding(uint16_t max_wait_time_ms,
bool prefer_late_decoding) { bool prefer_late_decoding) {
const int64_t start_time_ms = clock_->TimeInMilliseconds(); const int64_t start_time_ms = clock_->TimeInMilliseconds();

View File

@ -42,7 +42,6 @@ class VCMReceiver {
~VCMReceiver(); ~VCMReceiver();
void Reset();
int32_t InsertPacket(const VCMPacket& packet); int32_t InsertPacket(const VCMPacket& packet);
VCMEncodedFrame* FrameForDecoding(uint16_t max_wait_time_ms, VCMEncodedFrame* FrameForDecoding(uint16_t max_wait_time_ms,
bool prefer_late_decoding); bool prefer_late_decoding);
@ -54,10 +53,7 @@ class VCMReceiver {
int max_incomplete_time_ms); int max_incomplete_time_ms);
std::vector<uint16_t> NackList(bool* request_key_frame); std::vector<uint16_t> NackList(bool* request_key_frame);
void TriggerDecoderShutdown();
private: private:
rtc::CriticalSection crit_sect_;
Clock* const clock_; Clock* const clock_;
VCMJitterBuffer jitter_buffer_; VCMJitterBuffer jitter_buffer_;
VCMTiming* timing_; VCMTiming* timing_;

View File

@ -37,7 +37,7 @@ class TestVCMReceiver : public ::testing::Test {
new StreamGenerator(0, clock_->TimeInMilliseconds())); new StreamGenerator(0, clock_->TimeInMilliseconds()));
} }
virtual void SetUp() { receiver_.Reset(); } virtual void SetUp() {}
int32_t InsertPacket(int index) { int32_t InsertPacket(int index) {
VCMPacket packet; VCMPacket packet;
@ -378,7 +378,7 @@ class VCMReceiverTimingTest : public ::testing::Test {
std::unique_ptr<EventWrapper>( std::unique_ptr<EventWrapper>(
new FrameInjectEvent(&clock_, true))) {} new FrameInjectEvent(&clock_, true))) {}
virtual void SetUp() { receiver_.Reset(); } virtual void SetUp() {}
SimulatedClockWithFrames clock_; SimulatedClockWithFrames clock_;
StreamGenerator stream_generator_; StreamGenerator stream_generator_;

View File

@ -71,8 +71,6 @@ class VideoReceiver : public Module {
int32_t Decode(uint16_t maxWaitTimeMs); int32_t Decode(uint16_t maxWaitTimeMs);
int32_t Decode(const webrtc::VCMEncodedFrame* frame);
int32_t IncomingPacket(const uint8_t* incomingPayload, int32_t IncomingPacket(const uint8_t* incomingPayload,
size_t payloadLength, size_t payloadLength,
const RTPHeader& rtp_header, const RTPHeader& rtp_header,
@ -86,14 +84,6 @@ class VideoReceiver : public Module {
void Process() override; void Process() override;
void ProcessThreadAttached(ProcessThread* process_thread) override; void ProcessThreadAttached(ProcessThread* process_thread) override;
void TriggerDecoderShutdown();
// Notification methods that are used to check our internal state and validate
// threading assumptions. These are called by VideoReceiveStream.
// See |IsDecoderThreadRunning()| for more details.
void DecoderThreadStarting();
void DecoderThreadStopped();
protected: protected:
int32_t Decode(const webrtc::VCMEncodedFrame& frame); int32_t Decode(const webrtc::VCMEncodedFrame& frame);
int32_t RequestKeyFrame(); int32_t RequestKeyFrame();
@ -144,9 +134,6 @@ class VideoReceiver : public Module {
ProcessThread* process_thread_ = nullptr; ProcessThread* process_thread_ = nullptr;
bool is_attached_to_process_thread_ bool is_attached_to_process_thread_
RTC_GUARDED_BY(construction_thread_checker_) = false; RTC_GUARDED_BY(construction_thread_checker_) = false;
#if RTC_DCHECK_IS_ON
bool decoder_thread_is_running_ = false;
#endif
}; };
} // namespace vcm } // namespace vcm

View File

@ -141,7 +141,6 @@ int64_t VideoReceiver::TimeUntilNextProcess() {
int32_t VideoReceiver::RegisterReceiveCallback( int32_t VideoReceiver::RegisterReceiveCallback(
VCMReceiveCallback* receiveCallback) { VCMReceiveCallback* receiveCallback) {
RTC_DCHECK_RUN_ON(&construction_thread_checker_); RTC_DCHECK_RUN_ON(&construction_thread_checker_);
RTC_DCHECK(!IsDecoderThreadRunning());
// This value is set before the decoder thread starts and unset after // This value is set before the decoder thread starts and unset after
// the decoder thread has been stopped. // the decoder thread has been stopped.
_decodedFrameCallback.SetUserReceiveCallback(receiveCallback); _decodedFrameCallback.SetUserReceiveCallback(receiveCallback);
@ -152,7 +151,6 @@ int32_t VideoReceiver::RegisterReceiveCallback(
void VideoReceiver::RegisterExternalDecoder(VideoDecoder* externalDecoder, void VideoReceiver::RegisterExternalDecoder(VideoDecoder* externalDecoder,
uint8_t payloadType) { uint8_t payloadType) {
RTC_DCHECK_RUN_ON(&construction_thread_checker_); RTC_DCHECK_RUN_ON(&construction_thread_checker_);
RTC_DCHECK(!IsDecoderThreadRunning());
if (externalDecoder == nullptr) { if (externalDecoder == nullptr) {
RTC_CHECK(_codecDataBase.DeregisterExternalDecoder(payloadType)); RTC_CHECK(_codecDataBase.DeregisterExternalDecoder(payloadType));
return; return;
@ -164,7 +162,7 @@ void VideoReceiver::RegisterExternalDecoder(VideoDecoder* externalDecoder,
int32_t VideoReceiver::RegisterFrameTypeCallback( int32_t VideoReceiver::RegisterFrameTypeCallback(
VCMFrameTypeCallback* frameTypeCallback) { VCMFrameTypeCallback* frameTypeCallback) {
RTC_DCHECK_RUN_ON(&construction_thread_checker_); RTC_DCHECK_RUN_ON(&construction_thread_checker_);
RTC_DCHECK(!IsDecoderThreadRunning() && !is_attached_to_process_thread_); RTC_DCHECK(!is_attached_to_process_thread_);
// This callback is used on the module thread, but since we don't get // This callback is used on the module thread, but since we don't get
// callbacks on the module thread while the decoder thread isn't running // callbacks on the module thread while the decoder thread isn't running
// (and this function must not be called when the decoder is running), // (and this function must not be called when the decoder is running),
@ -176,7 +174,7 @@ int32_t VideoReceiver::RegisterFrameTypeCallback(
int32_t VideoReceiver::RegisterPacketRequestCallback( int32_t VideoReceiver::RegisterPacketRequestCallback(
VCMPacketRequestCallback* callback) { VCMPacketRequestCallback* callback) {
RTC_DCHECK_RUN_ON(&construction_thread_checker_); RTC_DCHECK_RUN_ON(&construction_thread_checker_);
RTC_DCHECK(!IsDecoderThreadRunning() && !is_attached_to_process_thread_); RTC_DCHECK(!is_attached_to_process_thread_);
// This callback is used on the module thread, but since we don't get // This callback is used on the module thread, but since we don't get
// callbacks on the module thread while the decoder thread isn't running // callbacks on the module thread while the decoder thread isn't running
// (and this function must not be called when the decoder is running), // (and this function must not be called when the decoder is running),
@ -185,35 +183,6 @@ int32_t VideoReceiver::RegisterPacketRequestCallback(
return VCM_OK; return VCM_OK;
} }
void VideoReceiver::TriggerDecoderShutdown() {
RTC_DCHECK_RUN_ON(&construction_thread_checker_);
RTC_DCHECK(IsDecoderThreadRunning());
_receiver.TriggerDecoderShutdown();
}
void VideoReceiver::DecoderThreadStarting() {
RTC_DCHECK_RUN_ON(&construction_thread_checker_);
RTC_DCHECK(!IsDecoderThreadRunning());
if (process_thread_ && !is_attached_to_process_thread_) {
process_thread_->RegisterModule(this, RTC_FROM_HERE);
}
#if RTC_DCHECK_IS_ON
decoder_thread_is_running_ = true;
#endif
}
void VideoReceiver::DecoderThreadStopped() {
RTC_DCHECK_RUN_ON(&construction_thread_checker_);
RTC_DCHECK(IsDecoderThreadRunning());
if (process_thread_ && is_attached_to_process_thread_) {
process_thread_->DeRegisterModule(this);
}
#if RTC_DCHECK_IS_ON
decoder_thread_is_running_ = false;
decoder_thread_checker_.Detach();
#endif
}
// Decode next frame, blocking. // Decode next frame, blocking.
// Should be called as often as possible to get the most out of the decoder. // Should be called as often as possible to get the most out of the decoder.
int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) { int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) {
@ -263,21 +232,9 @@ int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) {
return ret; return ret;
} }
// Used for the new jitter buffer.
// TODO(philipel): Clean up among the Decode functions as we replace
// VCMEncodedFrame with FrameObject.
int32_t VideoReceiver::Decode(const webrtc::VCMEncodedFrame* frame) {
RTC_DCHECK_RUN_ON(&decoder_thread_checker_);
return Decode(*frame);
}
int32_t VideoReceiver::RequestKeyFrame() { int32_t VideoReceiver::RequestKeyFrame() {
RTC_DCHECK_RUN_ON(&module_thread_checker_); RTC_DCHECK_RUN_ON(&module_thread_checker_);
// Since we deregister from the module thread when the decoder thread isn't
// running, we should get no calls here if decoding isn't being done.
RTC_DCHECK(IsDecoderThreadRunning());
TRACE_EVENT0("webrtc", "RequestKeyFrame"); TRACE_EVENT0("webrtc", "RequestKeyFrame");
if (_frameTypeCallback != nullptr) { if (_frameTypeCallback != nullptr) {
const int32_t ret = _frameTypeCallback->RequestKeyFrame(); const int32_t ret = _frameTypeCallback->RequestKeyFrame();
@ -310,7 +267,6 @@ int32_t VideoReceiver::RegisterReceiveCodec(const VideoCodec* receiveCodec,
int32_t numberOfCores, int32_t numberOfCores,
bool requireKeyFrame) { bool requireKeyFrame) {
RTC_DCHECK_RUN_ON(&construction_thread_checker_); RTC_DCHECK_RUN_ON(&construction_thread_checker_);
RTC_DCHECK(!IsDecoderThreadRunning());
if (receiveCodec == nullptr) { if (receiveCodec == nullptr) {
return VCM_PARAMETER_ERROR; return VCM_PARAMETER_ERROR;
} }
@ -361,7 +317,6 @@ void VideoReceiver::SetNackSettings(size_t max_nack_list_size,
int max_packet_age_to_nack, int max_packet_age_to_nack,
int max_incomplete_time_ms) { int max_incomplete_time_ms) {
RTC_DCHECK_RUN_ON(&construction_thread_checker_); RTC_DCHECK_RUN_ON(&construction_thread_checker_);
RTC_DCHECK(!IsDecoderThreadRunning());
if (max_nack_list_size != 0) { if (max_nack_list_size != 0) {
max_nack_list_size_ = max_nack_list_size; max_nack_list_size_ = max_nack_list_size;
} }
@ -369,13 +324,5 @@ void VideoReceiver::SetNackSettings(size_t max_nack_list_size,
max_incomplete_time_ms); max_incomplete_time_ms);
} }
bool VideoReceiver::IsDecoderThreadRunning() {
#if RTC_DCHECK_IS_ON
return decoder_thread_is_running_;
#else
return true;
#endif
}
} // namespace vcm } // namespace vcm
} // namespace webrtc } // namespace webrtc