2013-09-14 00:25:28 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include <stddef.h>
|
2019-07-05 19:08:33 +02:00
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include <cstdint>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "api/rtp_headers.h"
|
2021-02-10 14:31:24 +01:00
|
|
|
#include "api/sequence_checker.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "api/video_codecs/video_codec.h"
|
|
|
|
|
#include "api/video_codecs/video_decoder.h"
|
2018-02-21 15:56:05 +01:00
|
|
|
#include "modules/utility/include/process_thread.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "modules/video_coding/decoder_database.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/video_coding/encoded_frame.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "modules/video_coding/generic_decoder.h"
|
|
|
|
|
#include "modules/video_coding/include/video_coding.h"
|
|
|
|
|
#include "modules/video_coding/include/video_coding_defines.h"
|
|
|
|
|
#include "modules/video_coding/internal_defines.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/video_coding/jitter_buffer.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "modules/video_coding/media_opt_util.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/video_coding/packet.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "modules/video_coding/receiver.h"
|
|
|
|
|
#include "modules/video_coding/timing.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/video_coding/video_coding_impl.h"
|
|
|
|
|
#include "rtc_base/checks.h"
|
2018-02-21 15:56:05 +01:00
|
|
|
#include "rtc_base/location.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/logging.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "rtc_base/one_time_event.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/trace_event.h"
|
|
|
|
|
#include "system_wrappers/include/clock.h"
|
2013-09-14 00:25:28 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace vcm {
|
|
|
|
|
|
2022-03-25 12:43:14 +01:00
|
|
|
VideoReceiver::VideoReceiver(Clock* clock,
|
|
|
|
|
VCMTiming* timing,
|
2022-03-29 11:04:48 +02:00
|
|
|
const FieldTrialsView& field_trials)
|
2014-04-11 14:08:35 +00:00
|
|
|
: clock_(clock),
|
2016-12-15 07:10:57 -08:00
|
|
|
_timing(timing),
|
2022-03-25 12:43:14 +01:00
|
|
|
_receiver(_timing, clock_, field_trials),
|
|
|
|
|
_decodedFrameCallback(_timing, clock_, field_trials),
|
2016-04-15 01:24:14 -07:00
|
|
|
_frameTypeCallback(nullptr),
|
|
|
|
|
_packetRequestCallback(nullptr),
|
2013-09-14 00:25:28 +00:00
|
|
|
_scheduleKeyRequest(false),
|
2016-02-02 15:40:04 +01:00
|
|
|
drop_frames_until_keyframe_(false),
|
2013-09-14 00:25:28 +00:00
|
|
|
max_nack_list_size_(0),
|
2018-02-20 16:09:48 +01:00
|
|
|
_codecDataBase(),
|
2013-09-14 00:25:28 +00:00
|
|
|
_retransmissionTimer(10, clock_),
|
2018-02-21 15:56:05 +01:00
|
|
|
_keyRequestTimer(500, clock_) {
|
2019-04-08 15:20:44 +02:00
|
|
|
decoder_thread_checker_.Detach();
|
|
|
|
|
module_thread_checker_.Detach();
|
2018-02-21 15:56:05 +01:00
|
|
|
}
|
2013-09-14 00:25:28 +00:00
|
|
|
|
2018-02-21 15:56:05 +01:00
|
|
|
VideoReceiver::~VideoReceiver() {
|
|
|
|
|
RTC_DCHECK_RUN_ON(&construction_thread_checker_);
|
|
|
|
|
}
|
2013-09-14 00:25:28 +00:00
|
|
|
|
2016-02-25 04:50:01 -08:00
|
|
|
void VideoReceiver::Process() {
|
2018-02-21 15:56:05 +01:00
|
|
|
RTC_DCHECK_RUN_ON(&module_thread_checker_);
|
2013-09-14 00:25:28 +00:00
|
|
|
|
|
|
|
|
// Key frame requests
|
|
|
|
|
if (_keyRequestTimer.TimeUntilProcess() == 0) {
|
|
|
|
|
_keyRequestTimer.Processed();
|
2018-02-21 15:56:05 +01:00
|
|
|
bool request_key_frame = _frameTypeCallback != nullptr;
|
|
|
|
|
if (request_key_frame) {
|
2020-07-07 12:17:12 +02:00
|
|
|
MutexLock lock(&process_mutex_);
|
2018-02-21 15:56:05 +01:00
|
|
|
request_key_frame = _scheduleKeyRequest;
|
2014-01-29 10:27:51 +00:00
|
|
|
}
|
2016-02-25 04:50:01 -08:00
|
|
|
if (request_key_frame)
|
|
|
|
|
RequestKeyFrame();
|
2013-09-14 00:25:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Packet retransmission requests
|
|
|
|
|
// TODO(holmer): Add API for changing Process interval and make sure it's
|
|
|
|
|
// disabled when NACK is off.
|
|
|
|
|
if (_retransmissionTimer.TimeUntilProcess() == 0) {
|
|
|
|
|
_retransmissionTimer.Processed();
|
2018-02-21 15:56:05 +01:00
|
|
|
bool callback_registered = _packetRequestCallback != nullptr;
|
|
|
|
|
uint16_t length = max_nack_list_size_;
|
2014-01-29 10:27:51 +00:00
|
|
|
if (callback_registered && length > 0) {
|
2015-06-03 15:03:35 -07:00
|
|
|
// Collect sequence numbers from the default receiver.
|
|
|
|
|
bool request_key_frame = false;
|
|
|
|
|
std::vector<uint16_t> nackList = _receiver.NackList(&request_key_frame);
|
|
|
|
|
int32_t ret = VCM_OK;
|
|
|
|
|
if (request_key_frame) {
|
|
|
|
|
ret = RequestKeyFrame();
|
2013-09-14 00:25:28 +00:00
|
|
|
}
|
2015-06-03 15:03:35 -07:00
|
|
|
if (ret == VCM_OK && !nackList.empty()) {
|
2020-07-07 12:17:12 +02:00
|
|
|
MutexLock lock(&process_mutex_);
|
2016-04-15 01:24:14 -07:00
|
|
|
if (_packetRequestCallback != nullptr) {
|
2015-06-03 15:03:35 -07:00
|
|
|
_packetRequestCallback->ResendPackets(&nackList[0], nackList.size());
|
2014-01-29 10:27:51 +00:00
|
|
|
}
|
2013-09-14 00:25:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-21 15:56:05 +01:00
|
|
|
void VideoReceiver::ProcessThreadAttached(ProcessThread* process_thread) {
|
|
|
|
|
RTC_DCHECK_RUN_ON(&construction_thread_checker_);
|
|
|
|
|
if (process_thread) {
|
|
|
|
|
is_attached_to_process_thread_ = true;
|
|
|
|
|
RTC_DCHECK(!process_thread_ || process_thread_ == process_thread);
|
|
|
|
|
process_thread_ = process_thread;
|
|
|
|
|
} else {
|
|
|
|
|
is_attached_to_process_thread_ = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-15 22:09:40 +00:00
|
|
|
int64_t VideoReceiver::TimeUntilNextProcess() {
|
2018-02-21 15:56:05 +01:00
|
|
|
RTC_DCHECK_RUN_ON(&module_thread_checker_);
|
2020-04-02 22:59:29 +02:00
|
|
|
int64_t timeUntilNextProcess = _retransmissionTimer.TimeUntilProcess();
|
2019-04-11 15:27:17 +02:00
|
|
|
|
2013-09-14 00:25:28 +00:00
|
|
|
timeUntilNextProcess =
|
|
|
|
|
VCM_MIN(timeUntilNextProcess, _keyRequestTimer.TimeUntilProcess());
|
|
|
|
|
|
|
|
|
|
return timeUntilNextProcess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Register a receive callback. Will be called whenever there is a new frame
|
|
|
|
|
// ready for rendering.
|
|
|
|
|
int32_t VideoReceiver::RegisterReceiveCallback(
|
|
|
|
|
VCMReceiveCallback* receiveCallback) {
|
2018-02-21 15:56:05 +01:00
|
|
|
RTC_DCHECK_RUN_ON(&construction_thread_checker_);
|
|
|
|
|
// This value is set before the decoder thread starts and unset after
|
|
|
|
|
// the decoder thread has been stopped.
|
2013-09-14 00:25:28 +00:00
|
|
|
_decodedFrameCallback.SetUserReceiveCallback(receiveCallback);
|
|
|
|
|
return VCM_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-10 09:27:38 -08:00
|
|
|
// Register an externally defined decoder object.
|
2015-11-27 14:09:07 +01:00
|
|
|
void VideoReceiver::RegisterExternalDecoder(VideoDecoder* externalDecoder,
|
2015-12-10 09:27:38 -08:00
|
|
|
uint8_t payloadType) {
|
2018-02-21 15:56:05 +01:00
|
|
|
RTC_DCHECK_RUN_ON(&construction_thread_checker_);
|
2016-04-15 01:24:14 -07:00
|
|
|
if (externalDecoder == nullptr) {
|
2015-11-27 14:09:07 +01:00
|
|
|
RTC_CHECK(_codecDataBase.DeregisterExternalDecoder(payloadType));
|
2015-11-27 15:23:12 +01:00
|
|
|
return;
|
2013-09-14 00:25:28 +00:00
|
|
|
}
|
2021-08-06 12:30:02 +02:00
|
|
|
_codecDataBase.RegisterExternalDecoder(payloadType, externalDecoder);
|
2013-09-14 00:25:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Register a frame type request callback.
|
|
|
|
|
int32_t VideoReceiver::RegisterFrameTypeCallback(
|
|
|
|
|
VCMFrameTypeCallback* frameTypeCallback) {
|
2018-02-21 15:56:05 +01:00
|
|
|
RTC_DCHECK_RUN_ON(&construction_thread_checker_);
|
2019-09-10 13:02:28 +02:00
|
|
|
RTC_DCHECK(!is_attached_to_process_thread_);
|
2018-02-21 15:56:05 +01:00
|
|
|
// 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
|
|
|
|
|
// (and this function must not be called when the decoder is running),
|
|
|
|
|
// we don't need a lock here.
|
2013-09-14 00:25:28 +00:00
|
|
|
_frameTypeCallback = frameTypeCallback;
|
|
|
|
|
return VCM_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int32_t VideoReceiver::RegisterPacketRequestCallback(
|
|
|
|
|
VCMPacketRequestCallback* callback) {
|
2018-02-21 15:56:05 +01:00
|
|
|
RTC_DCHECK_RUN_ON(&construction_thread_checker_);
|
2019-09-10 13:02:28 +02:00
|
|
|
RTC_DCHECK(!is_attached_to_process_thread_);
|
2018-02-21 15:56:05 +01:00
|
|
|
// 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
|
|
|
|
|
// (and this function must not be called when the decoder is running),
|
|
|
|
|
// we don't need a lock here.
|
2013-09-14 00:25:28 +00:00
|
|
|
_packetRequestCallback = callback;
|
|
|
|
|
return VCM_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Decode next frame, blocking.
|
|
|
|
|
// Should be called as often as possible to get the most out of the decoder.
|
|
|
|
|
int32_t VideoReceiver::Decode(uint16_t maxWaitTimeMs) {
|
2018-02-21 15:56:05 +01:00
|
|
|
RTC_DCHECK_RUN_ON(&decoder_thread_checker_);
|
2021-01-11 15:44:43 +01:00
|
|
|
VCMEncodedFrame* frame = _receiver.FrameForDecoding(maxWaitTimeMs, true);
|
2013-09-14 00:25:28 +00:00
|
|
|
|
2015-12-18 16:01:11 +01:00
|
|
|
if (!frame)
|
2013-09-14 00:25:28 +00:00
|
|
|
return VCM_FRAME_NOT_READY;
|
|
|
|
|
|
2018-02-21 15:56:05 +01:00
|
|
|
bool drop_frame = false;
|
2016-02-02 15:40:04 +01:00
|
|
|
{
|
2020-07-07 12:17:12 +02:00
|
|
|
MutexLock lock(&process_mutex_);
|
2016-02-02 15:40:04 +01:00
|
|
|
if (drop_frames_until_keyframe_) {
|
|
|
|
|
// Still getting delta frames, schedule another keyframe request as if
|
|
|
|
|
// decode failed.
|
2019-03-21 15:43:58 +01:00
|
|
|
if (frame->FrameType() != VideoFrameType::kVideoFrameKey) {
|
2018-02-21 15:56:05 +01:00
|
|
|
drop_frame = true;
|
2016-02-02 15:40:04 +01:00
|
|
|
_scheduleKeyRequest = true;
|
2018-02-21 15:56:05 +01:00
|
|
|
// TODO(tommi): Consider if we could instead post a task to the module
|
|
|
|
|
// thread and call RequestKeyFrame directly. Here we call WakeUp so that
|
|
|
|
|
// TimeUntilNextProcess() gets called straight away.
|
|
|
|
|
process_thread_->WakeUp(this);
|
|
|
|
|
} else {
|
|
|
|
|
drop_frames_until_keyframe_ = false;
|
2016-02-02 15:40:04 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-09-14 00:25:28 +00:00
|
|
|
|
2018-02-21 15:56:05 +01:00
|
|
|
if (drop_frame) {
|
|
|
|
|
_receiver.ReleaseFrame(frame);
|
|
|
|
|
return VCM_FRAME_NOT_READY;
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-15 01:24:14 -07:00
|
|
|
// If this frame was too late, we should adjust the delay accordingly
|
2022-03-02 15:13:55 +01:00
|
|
|
if (frame->RenderTimeMs() > 0)
|
|
|
|
|
_timing->UpdateCurrentDelay(Timestamp::Millis(frame->RenderTimeMs()),
|
|
|
|
|
clock_->CurrentTime());
|
2016-04-07 15:36:45 -07:00
|
|
|
|
|
|
|
|
if (first_frame_received_()) {
|
2020-10-28 15:50:15 +01:00
|
|
|
RTC_LOG(LS_INFO) << "Received first complete decodable video frame";
|
2016-04-07 15:36:45 -07:00
|
|
|
}
|
|
|
|
|
|
2015-12-18 16:01:11 +01:00
|
|
|
const int32_t ret = Decode(*frame);
|
|
|
|
|
_receiver.ReleaseFrame(frame);
|
|
|
|
|
return ret;
|
2013-09-14 00:25:28 +00:00
|
|
|
}
|
|
|
|
|
|
2018-02-21 19:37:14 +00:00
|
|
|
int32_t VideoReceiver::RequestKeyFrame() {
|
2018-02-21 15:56:05 +01:00
|
|
|
RTC_DCHECK_RUN_ON(&module_thread_checker_);
|
|
|
|
|
|
2013-09-14 00:25:28 +00:00
|
|
|
TRACE_EVENT0("webrtc", "RequestKeyFrame");
|
2016-04-15 01:24:14 -07:00
|
|
|
if (_frameTypeCallback != nullptr) {
|
2013-09-14 00:25:28 +00:00
|
|
|
const int32_t ret = _frameTypeCallback->RequestKeyFrame();
|
|
|
|
|
if (ret < 0) {
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2020-07-07 12:17:12 +02:00
|
|
|
MutexLock lock(&process_mutex_);
|
2013-09-14 00:25:28 +00:00
|
|
|
_scheduleKeyRequest = false;
|
|
|
|
|
} else {
|
|
|
|
|
return VCM_MISSING_CALLBACK;
|
|
|
|
|
}
|
|
|
|
|
return VCM_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Must be called from inside the receive side critical section.
|
|
|
|
|
int32_t VideoReceiver::Decode(const VCMEncodedFrame& frame) {
|
2018-02-21 15:56:05 +01:00
|
|
|
RTC_DCHECK_RUN_ON(&decoder_thread_checker_);
|
2017-03-03 07:21:18 -08:00
|
|
|
TRACE_EVENT0("webrtc", "VideoReceiver::Decode");
|
2013-09-14 00:25:28 +00:00
|
|
|
// Change decoder if payload type has changed
|
2017-03-14 04:16:20 -07:00
|
|
|
VCMGenericDecoder* decoder =
|
|
|
|
|
_codecDataBase.GetDecoder(frame, &_decodedFrameCallback);
|
|
|
|
|
if (decoder == nullptr) {
|
2013-09-14 00:25:28 +00:00
|
|
|
return VCM_NO_CODEC_REGISTERED;
|
|
|
|
|
}
|
2020-01-16 14:09:33 +01:00
|
|
|
return decoder->Decode(frame, clock_->CurrentTime());
|
2013-09-14 00:25:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Register possible receive codecs, can be called multiple times
|
2021-08-13 18:15:55 +02:00
|
|
|
void VideoReceiver::RegisterReceiveCodec(
|
2021-08-13 16:50:37 +02:00
|
|
|
uint8_t payload_type,
|
|
|
|
|
const VideoDecoder::Settings& settings) {
|
2018-02-21 15:56:05 +01:00
|
|
|
RTC_DCHECK_RUN_ON(&construction_thread_checker_);
|
2021-08-13 18:15:55 +02:00
|
|
|
_codecDataBase.RegisterReceiveCodec(payload_type, settings);
|
2013-09-14 00:25:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Incoming packet from network parsed and ready for decode, non blocking.
|
|
|
|
|
int32_t VideoReceiver::IncomingPacket(const uint8_t* incomingPayload,
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
size_t payloadLength,
|
2019-04-25 10:02:52 +02:00
|
|
|
const RTPHeader& rtp_header,
|
|
|
|
|
const RTPVideoHeader& video_header) {
|
2018-02-21 15:56:05 +01:00
|
|
|
RTC_DCHECK_RUN_ON(&module_thread_checker_);
|
2019-04-25 10:02:52 +02:00
|
|
|
if (video_header.frame_type == VideoFrameType::kVideoFrameKey) {
|
2015-12-21 04:12:39 -08:00
|
|
|
TRACE_EVENT1("webrtc", "VCM::PacketKeyFrame", "seqnum",
|
2019-04-25 10:02:52 +02:00
|
|
|
rtp_header.sequenceNumber);
|
2013-09-14 00:25:28 +00:00
|
|
|
}
|
2016-04-15 01:24:14 -07:00
|
|
|
if (incomingPayload == nullptr) {
|
2013-09-14 00:25:28 +00:00
|
|
|
// The jitter buffer doesn't handle non-zero payload lengths for packets
|
|
|
|
|
// without payload.
|
|
|
|
|
// TODO(holmer): We should fix this in the jitter buffer.
|
|
|
|
|
payloadLength = 0;
|
|
|
|
|
}
|
2019-04-25 10:02:52 +02:00
|
|
|
// Callers don't provide any ntp time.
|
|
|
|
|
const VCMPacket packet(incomingPayload, payloadLength, rtp_header,
|
2019-06-20 10:05:55 +02:00
|
|
|
video_header, /*ntp_time_ms=*/0,
|
2021-04-30 13:10:56 +02:00
|
|
|
clock_->CurrentTime());
|
2016-06-28 11:11:28 +02:00
|
|
|
int32_t ret = _receiver.InsertPacket(packet);
|
2016-04-15 01:24:14 -07:00
|
|
|
|
2013-09-14 00:25:28 +00:00
|
|
|
// TODO(holmer): Investigate if this somehow should use the key frame
|
|
|
|
|
// request scheduling to throttle the requests.
|
|
|
|
|
if (ret == VCM_FLUSH_INDICATOR) {
|
2016-02-02 15:40:04 +01:00
|
|
|
{
|
2020-07-07 12:17:12 +02:00
|
|
|
MutexLock lock(&process_mutex_);
|
2016-02-02 15:40:04 +01:00
|
|
|
drop_frames_until_keyframe_ = true;
|
|
|
|
|
}
|
2013-09-14 00:25:28 +00:00
|
|
|
RequestKeyFrame();
|
|
|
|
|
} else if (ret < 0) {
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
return VCM_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoReceiver::SetNackSettings(size_t max_nack_list_size,
|
|
|
|
|
int max_packet_age_to_nack,
|
|
|
|
|
int max_incomplete_time_ms) {
|
2018-02-21 15:56:05 +01:00
|
|
|
RTC_DCHECK_RUN_ON(&construction_thread_checker_);
|
Revert of Deliver video frames on Android, on the decode thread. (patchset #7 id:120001 of https://codereview.webrtc.org/2764573002/ )
Reason for revert:
Breaks Chrome FYI Android bots.
See:
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/20418
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus6%29/builds/14724
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/builds/20133
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28K%20Nexus5%29/builds/15111
Original issue's description:
> Deliver video frames on Android, on the decode thread.
>
> VideoCoding
> * Adding a method for polling for frames on Android only until the capture implementation takes care of this (longer term plan).
>
> CodecDatabase
> * Add an accessor for the current decoder
> * Use std::unique_ptr<> for ownership.
> * Remove "Release()" and "ReleaseDecoder()". Instead just delete.
> * Remove |friend| relationship between CodecDatabase and VCMGenericDecoder.
>
> VCMDecodedFrameCallback
> * DCHECKs for thread correctness.
> * Remove |lock_| now that a threading model has been established and verified.
>
> VCMGenericDecoder
> * All methods now have thread checks.
> * Variable access associated with thread checkers.
>
> VideoReceiver
> * Added two notification methods, DecoderThreadStarting() and DecoderThreadStopped()
> * Allows us to establish a period when the decoder thread is not running and it is safe to modify variables such as callbacks, that are only read when the decoder thread is running.
> * Allows us to DCHECK thread guarantees.
> * Allows synchronizing callbacks from the module process thread and have them only active while the decoder thread is running.
> * The above, allows us to establish two modes for the thread, single-threaded-mutable and multi-threaded-const.
> * Using that knowledge, we can remove |receive_crit_| as well as locking for a number of member variables.
>
> MediaCodecVideoDecoder
> * Removed frame polling code from this class, since this is now done from the root thread function in VideoReceiveStream.
>
> VideoReceiveStream
> * On Android: Polls for decoded frames every 10ms (same interval as previously in MediaCodecVideoDecoder)
> * [Un]Registers the |video_receiver_| with the module thread only around the time the decoder thread is started/stopped.
> * Notifies the receiver of start/stop events of the decoder thread.
> * Changed the decoder thread to use the new PlatformThread callback type.
>
> BUG=webrtc:7361, 695438
>
> Review-Url: https://codereview.webrtc.org/2764573002
> Cr-Commit-Position: refs/heads/master@{#17527}
> Committed: https://chromium.googlesource.com/external/webrtc/+/e3aa88bbd5accadec73fa7e38584dfbf6aabe8a9
TBR=sakal@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org,tommi@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7361, 695438
Review-Url: https://codereview.webrtc.org/2792033003
Cr-Commit-Position: refs/heads/master@{#17530}
2017-04-04 07:16:21 -07:00
|
|
|
if (max_nack_list_size != 0) {
|
2013-09-14 00:25:28 +00:00
|
|
|
max_nack_list_size_ = max_nack_list_size;
|
Revert of Deliver video frames on Android, on the decode thread. (patchset #7 id:120001 of https://codereview.webrtc.org/2764573002/ )
Reason for revert:
Breaks Chrome FYI Android bots.
See:
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus9%29/builds/20418
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus6%29/builds/14724
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28L%20Nexus5%29/builds/20133
https://build.chromium.org/p/chromium.webrtc.fyi/builders/Android%20Tests%20%28dbg%29%20%28K%20Nexus5%29/builds/15111
Original issue's description:
> Deliver video frames on Android, on the decode thread.
>
> VideoCoding
> * Adding a method for polling for frames on Android only until the capture implementation takes care of this (longer term plan).
>
> CodecDatabase
> * Add an accessor for the current decoder
> * Use std::unique_ptr<> for ownership.
> * Remove "Release()" and "ReleaseDecoder()". Instead just delete.
> * Remove |friend| relationship between CodecDatabase and VCMGenericDecoder.
>
> VCMDecodedFrameCallback
> * DCHECKs for thread correctness.
> * Remove |lock_| now that a threading model has been established and verified.
>
> VCMGenericDecoder
> * All methods now have thread checks.
> * Variable access associated with thread checkers.
>
> VideoReceiver
> * Added two notification methods, DecoderThreadStarting() and DecoderThreadStopped()
> * Allows us to establish a period when the decoder thread is not running and it is safe to modify variables such as callbacks, that are only read when the decoder thread is running.
> * Allows us to DCHECK thread guarantees.
> * Allows synchronizing callbacks from the module process thread and have them only active while the decoder thread is running.
> * The above, allows us to establish two modes for the thread, single-threaded-mutable and multi-threaded-const.
> * Using that knowledge, we can remove |receive_crit_| as well as locking for a number of member variables.
>
> MediaCodecVideoDecoder
> * Removed frame polling code from this class, since this is now done from the root thread function in VideoReceiveStream.
>
> VideoReceiveStream
> * On Android: Polls for decoded frames every 10ms (same interval as previously in MediaCodecVideoDecoder)
> * [Un]Registers the |video_receiver_| with the module thread only around the time the decoder thread is started/stopped.
> * Notifies the receiver of start/stop events of the decoder thread.
> * Changed the decoder thread to use the new PlatformThread callback type.
>
> BUG=webrtc:7361, 695438
>
> Review-Url: https://codereview.webrtc.org/2764573002
> Cr-Commit-Position: refs/heads/master@{#17527}
> Committed: https://chromium.googlesource.com/external/webrtc/+/e3aa88bbd5accadec73fa7e38584dfbf6aabe8a9
TBR=sakal@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org,tommi@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7361, 695438
Review-Url: https://codereview.webrtc.org/2792033003
Cr-Commit-Position: refs/heads/master@{#17530}
2017-04-04 07:16:21 -07:00
|
|
|
}
|
2015-12-21 04:12:39 -08:00
|
|
|
_receiver.SetNackSettings(max_nack_list_size, max_packet_age_to_nack,
|
|
|
|
|
max_incomplete_time_ms);
|
2013-09-14 00:25:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace vcm
|
|
|
|
|
} // namespace webrtc
|