2016-11-22 01:43:03 -08:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2016 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MEDIA_ENGINE_VIDEODECODERSOFTWAREFALLBACKWRAPPER_H_
|
|
|
|
|
#define MEDIA_ENGINE_VIDEODECODERSOFTWAREFALLBACKWRAPPER_H_
|
2016-11-22 01:43:03 -08:00
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/video_codecs/video_decoder.h"
|
2016-11-22 01:43:03 -08:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
// Class used to wrap external VideoDecoders to provide a fallback option on
|
|
|
|
|
// software decoding when a hardware decoder fails to decode a stream due to
|
|
|
|
|
// hardware restrictions, such as max resolution.
|
2017-09-11 11:50:51 -07:00
|
|
|
class VideoDecoderSoftwareFallbackWrapper : public VideoDecoder {
|
2016-11-22 01:43:03 -08:00
|
|
|
public:
|
2017-11-09 13:43:42 +01:00
|
|
|
VideoDecoderSoftwareFallbackWrapper(
|
|
|
|
|
std::unique_ptr<VideoDecoder> sw_fallback_decoder,
|
|
|
|
|
std::unique_ptr<VideoDecoder> hw_decoder);
|
2016-11-22 01:43:03 -08:00
|
|
|
|
|
|
|
|
int32_t InitDecode(const VideoCodec* codec_settings,
|
|
|
|
|
int32_t number_of_cores) override;
|
|
|
|
|
|
|
|
|
|
int32_t Decode(const EncodedImage& input_image,
|
|
|
|
|
bool missing_frames,
|
|
|
|
|
const RTPFragmentationHeader* fragmentation,
|
|
|
|
|
const CodecSpecificInfo* codec_specific_info,
|
|
|
|
|
int64_t render_time_ms) override;
|
|
|
|
|
|
|
|
|
|
int32_t RegisterDecodeCompleteCallback(
|
|
|
|
|
DecodedImageCallback* callback) override;
|
|
|
|
|
|
|
|
|
|
int32_t Release() override;
|
|
|
|
|
bool PrefersLateDecoding() const override;
|
|
|
|
|
|
|
|
|
|
const char* ImplementationName() const override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool InitFallbackDecoder();
|
|
|
|
|
|
2017-11-09 13:43:42 +01:00
|
|
|
// Determines if we are trying to use the HW or SW decoder.
|
|
|
|
|
bool use_hw_decoder_;
|
|
|
|
|
std::unique_ptr<VideoDecoder> hw_decoder_;
|
|
|
|
|
bool hw_decoder_initialized_;
|
2016-11-22 01:43:03 -08:00
|
|
|
|
|
|
|
|
VideoCodec codec_settings_;
|
|
|
|
|
int32_t number_of_cores_;
|
2017-11-09 13:43:42 +01:00
|
|
|
const std::unique_ptr<VideoDecoder> fallback_decoder_;
|
|
|
|
|
const std::string fallback_implementation_name_;
|
2016-11-22 01:43:03 -08:00
|
|
|
DecodedImageCallback* callback_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MEDIA_ENGINE_VIDEODECODERSOFTWAREFALLBACKWRAPPER_H_
|