webrtc/modules/video_coding/video_receiver2.h
Erik Språng 79c96ded88 On receive stream shutdown, deregister decoders on decoder thread.
Now Configure(), Decode() and Release() calls to the decoders should
all happen on the decoder thread. Added thread checkers to verify.

Bug: None
Change-Id: I2a1cf2cf7f3c3c7c50e382d82a3638e916ed9c34
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272368
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37840}
2022-08-19 11:48:48 +00:00

62 lines
2.2 KiB
C++

/*
* Copyright (c) 2019 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.
*/
#ifndef MODULES_VIDEO_CODING_VIDEO_RECEIVER2_H_
#define MODULES_VIDEO_CODING_VIDEO_RECEIVER2_H_
#include "api/field_trials_view.h"
#include "api/sequence_checker.h"
#include "api/video_codecs/video_decoder.h"
#include "modules/video_coding/decoder_database.h"
#include "modules/video_coding/encoded_frame.h"
#include "modules/video_coding/generic_decoder.h"
#include "modules/video_coding/timing/timing.h"
#include "system_wrappers/include/clock.h"
namespace webrtc {
// This class is a copy of vcm::VideoReceiver, trimmed down to what's used by
// VideoReceive stream, with the aim to incrementally trim it down further and
// ultimately delete it. It's difficult to do this incrementally with the
// original VideoReceiver class, since it is used by the legacy
// VideoCodingModule api.
class VideoReceiver2 {
public:
VideoReceiver2(Clock* clock,
VCMTiming* timing,
const FieldTrialsView& field_trials);
~VideoReceiver2();
void RegisterReceiveCodec(uint8_t payload_type,
const VideoDecoder::Settings& decoder_settings);
void RegisterExternalDecoder(VideoDecoder* externalDecoder,
uint8_t payloadType);
bool IsExternalDecoderRegistered(uint8_t payloadType) const;
int32_t RegisterReceiveCallback(VCMReceiveCallback* receiveCallback);
int32_t Decode(const webrtc::VCMEncodedFrame* frame);
private:
SequenceChecker construction_sequence_checker_;
SequenceChecker decoder_sequence_checker_;
Clock* const clock_;
VCMTiming* timing_;
VCMDecodedFrameCallback decodedFrameCallback_;
// Callbacks are set before the decoder thread starts.
// Once the decoder thread has been started, usage of `_codecDataBase` moves
// over to the decoder thread.
VCMDecoderDataBase codecDataBase_;
};
} // namespace webrtc
#endif // MODULES_VIDEO_CODING_VIDEO_RECEIVER2_H_