OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 virtual int32_t Release() = 0; | 76 virtual int32_t Release() = 0; |
77 | 77 |
78 // Returns true if the decoder prefer to decode frames late. | 78 // Returns true if the decoder prefer to decode frames late. |
79 // That is, it can not decode infinite number of frames before the decoded | 79 // That is, it can not decode infinite number of frames before the decoded |
80 // frame is consumed. | 80 // frame is consumed. |
81 virtual bool PrefersLateDecoding() const { return true; } | 81 virtual bool PrefersLateDecoding() const { return true; } |
82 | 82 |
83 virtual const char* ImplementationName() const { return "unknown"; } | 83 virtual const char* ImplementationName() const { return "unknown"; } |
84 }; | 84 }; |
85 | 85 |
86 // Class used to wrap external VideoDecoders to provide a fallback option on | |
87 // software decoding when a hardware decoder fails to decode a stream due to | |
88 // hardware restrictions, such as max resolution. | |
89 class VideoDecoderSoftwareFallbackWrapper : public webrtc::VideoDecoder { | |
90 public: | |
91 VideoDecoderSoftwareFallbackWrapper(VideoCodecType codec_type, | |
92 VideoDecoder* decoder); | |
93 | |
94 int32_t InitDecode(const VideoCodec* codec_settings, | |
95 int32_t number_of_cores) override; | |
96 | |
97 int32_t Decode(const EncodedImage& input_image, | |
98 bool missing_frames, | |
99 const RTPFragmentationHeader* fragmentation, | |
100 const CodecSpecificInfo* codec_specific_info, | |
101 int64_t render_time_ms) override; | |
102 | |
103 int32_t RegisterDecodeCompleteCallback( | |
104 DecodedImageCallback* callback) override; | |
105 | |
106 int32_t Release() override; | |
107 bool PrefersLateDecoding() const override; | |
108 | |
109 const char* ImplementationName() const override; | |
110 | |
111 private: | |
112 bool InitFallbackDecoder(); | |
113 | |
114 const DecoderType decoder_type_; | |
115 VideoDecoder* const decoder_; | |
116 | |
117 VideoCodec codec_settings_; | |
118 int32_t number_of_cores_; | |
119 std::string fallback_implementation_name_; | |
120 std::unique_ptr<VideoDecoder> fallback_decoder_; | |
121 DecodedImageCallback* callback_; | |
122 }; | |
123 | |
124 // Video decoder class to be used for unknown codecs. Doesn't support decoding | 86 // Video decoder class to be used for unknown codecs. Doesn't support decoding |
125 // but logs messages to LS_ERROR. | 87 // but logs messages to LS_ERROR. |
126 class NullVideoDecoder : public VideoDecoder { | 88 class NullVideoDecoder : public VideoDecoder { |
127 public: | 89 public: |
128 NullVideoDecoder(); | 90 NullVideoDecoder(); |
129 | 91 |
130 int32_t InitDecode(const VideoCodec* codec_settings, | 92 int32_t InitDecode(const VideoCodec* codec_settings, |
131 int32_t number_of_cores) override; | 93 int32_t number_of_cores) override; |
132 | 94 |
133 int32_t Decode(const EncodedImage& input_image, | 95 int32_t Decode(const EncodedImage& input_image, |
134 bool missing_frames, | 96 bool missing_frames, |
135 const RTPFragmentationHeader* fragmentation, | 97 const RTPFragmentationHeader* fragmentation, |
136 const CodecSpecificInfo* codec_specific_info, | 98 const CodecSpecificInfo* codec_specific_info, |
137 int64_t render_time_ms) override; | 99 int64_t render_time_ms) override; |
138 | 100 |
139 int32_t RegisterDecodeCompleteCallback( | 101 int32_t RegisterDecodeCompleteCallback( |
140 DecodedImageCallback* callback) override; | 102 DecodedImageCallback* callback) override; |
141 | 103 |
142 int32_t Release() override; | 104 int32_t Release() override; |
143 | 105 |
144 const char* ImplementationName() const override; | 106 const char* ImplementationName() const override; |
145 }; | 107 }; |
146 | 108 |
147 } // namespace webrtc | 109 } // namespace webrtc |
148 | 110 |
149 #endif // WEBRTC_VIDEO_DECODER_H_ | 111 #endif // WEBRTC_VIDEO_DECODER_H_ |
OLD | NEW |