A few simplifications to CodecDatabase and VCMGenericDecoder.
* Remove the ReleaseDecoder and Release methods that were used in combination with deleting the decoder object. Now simply deleting the object does the right thing. * Remove 'friend' relationship between the two classes since they don't need to touch each other's state directly anymore. * Use std::unique_ptr for holding pointers and transferring ownership. These changes were previously reviewed here: https://codereview.webrtc.org/2764573002/ BUG=webrtc:7361, 695438 Review-Url: https://codereview.webrtc.org/2966823002 Cr-Commit-Position: refs/heads/master@{#18908}
This commit is contained in:
@ -11,6 +11,8 @@
|
||||
#ifndef WEBRTC_MODULES_VIDEO_CODING_GENERIC_DECODER_H_
|
||||
#define WEBRTC_MODULES_VIDEO_CODING_GENERIC_DECODER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/criticalsection.h"
|
||||
#include "webrtc/base/thread_checker.h"
|
||||
#include "webrtc/modules/include/module_common_types.h"
|
||||
@ -73,8 +75,6 @@ class VCMDecodedFrameCallback : public DecodedImageCallback {
|
||||
};
|
||||
|
||||
class VCMGenericDecoder {
|
||||
friend class VCMCodecDataBase;
|
||||
|
||||
public:
|
||||
explicit VCMGenericDecoder(VideoDecoder* decoder, bool isExternal = false);
|
||||
~VCMGenericDecoder();
|
||||
@ -91,11 +91,6 @@ class VCMGenericDecoder {
|
||||
*/
|
||||
int32_t Decode(const VCMEncodedFrame& inputFrame, int64_t nowMs);
|
||||
|
||||
/**
|
||||
* Free the decoder memory
|
||||
*/
|
||||
int32_t Release();
|
||||
|
||||
/**
|
||||
* Set decode callback. Deregistering while decoding is illegal.
|
||||
*/
|
||||
@ -103,15 +98,17 @@ class VCMGenericDecoder {
|
||||
|
||||
bool External() const;
|
||||
bool PrefersLateDecoding() const;
|
||||
bool IsSameDecoder(VideoDecoder* decoder) const {
|
||||
return decoder_.get() == decoder;
|
||||
}
|
||||
|
||||
private:
|
||||
VCMDecodedFrameCallback* _callback;
|
||||
VCMFrameInformation _frameInfos[kDecoderFrameMemoryLength];
|
||||
uint32_t _nextFrameInfoIdx;
|
||||
VideoDecoder* const _decoder;
|
||||
std::unique_ptr<VideoDecoder> decoder_;
|
||||
VideoCodecType _codecType;
|
||||
bool _isExternal;
|
||||
bool _keyFrameDecoded;
|
||||
const bool _isExternal;
|
||||
VideoContentType _last_keyframe_content_type;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user