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 |
11 #ifndef WEBRTC_VIDEO_DECODER_H_ | 11 #ifndef WEBRTC_VIDEO_DECODER_H_ |
12 #define WEBRTC_VIDEO_DECODER_H_ | 12 #define WEBRTC_VIDEO_DECODER_H_ |
13 | 13 |
| 14 #include <string> |
14 #include <vector> | 15 #include <vector> |
15 | 16 |
16 #include "webrtc/common_types.h" | 17 #include "webrtc/common_types.h" |
17 #include "webrtc/typedefs.h" | 18 #include "webrtc/typedefs.h" |
18 #include "webrtc/video_frame.h" | 19 #include "webrtc/video_frame.h" |
19 | 20 |
20 namespace webrtc { | 21 namespace webrtc { |
21 | 22 |
22 class RTPFragmentationHeader; | 23 class RTPFragmentationHeader; |
23 // TODO(pbos): Expose these through a public (root) header or change these APIs. | 24 // TODO(pbos): Expose these through a public (root) header or change these APIs. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 virtual int32_t RegisterDecodeCompleteCallback( | 72 virtual int32_t RegisterDecodeCompleteCallback( |
72 DecodedImageCallback* callback) = 0; | 73 DecodedImageCallback* callback) = 0; |
73 | 74 |
74 virtual int32_t Release() = 0; | 75 virtual int32_t Release() = 0; |
75 virtual int32_t Reset() = 0; | 76 virtual int32_t Reset() = 0; |
76 | 77 |
77 // Returns true if the decoder prefer to decode frames late. | 78 // Returns true if the decoder prefer to decode frames late. |
78 // 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 |
79 // frame is consumed. | 80 // frame is consumed. |
80 virtual bool PrefersLateDecoding() const { return true; } | 81 virtual bool PrefersLateDecoding() const { return true; } |
| 82 |
| 83 virtual const char* ImplementationName() const { return "unknown"; } |
81 }; | 84 }; |
82 | 85 |
83 // Class used to wrap external VideoDecoders to provide a fallback option on | 86 // Class used to wrap external VideoDecoders to provide a fallback option on |
84 // software decoding when a hardware decoder fails to decode a stream due to | 87 // software decoding when a hardware decoder fails to decode a stream due to |
85 // hardware restrictions, such as max resolution. | 88 // hardware restrictions, such as max resolution. |
86 class VideoDecoderSoftwareFallbackWrapper : public webrtc::VideoDecoder { | 89 class VideoDecoderSoftwareFallbackWrapper : public webrtc::VideoDecoder { |
87 public: | 90 public: |
88 VideoDecoderSoftwareFallbackWrapper(VideoCodecType codec_type, | 91 VideoDecoderSoftwareFallbackWrapper(VideoCodecType codec_type, |
89 VideoDecoder* decoder); | 92 VideoDecoder* decoder); |
90 | 93 |
91 int32_t InitDecode(const VideoCodec* codec_settings, | 94 int32_t InitDecode(const VideoCodec* codec_settings, |
92 int32_t number_of_cores) override; | 95 int32_t number_of_cores) override; |
93 | 96 |
94 int32_t Decode(const EncodedImage& input_image, | 97 int32_t Decode(const EncodedImage& input_image, |
95 bool missing_frames, | 98 bool missing_frames, |
96 const RTPFragmentationHeader* fragmentation, | 99 const RTPFragmentationHeader* fragmentation, |
97 const CodecSpecificInfo* codec_specific_info, | 100 const CodecSpecificInfo* codec_specific_info, |
98 int64_t render_time_ms) override; | 101 int64_t render_time_ms) override; |
99 | 102 |
100 int32_t RegisterDecodeCompleteCallback( | 103 int32_t RegisterDecodeCompleteCallback( |
101 DecodedImageCallback* callback) override; | 104 DecodedImageCallback* callback) override; |
102 | 105 |
103 int32_t Release() override; | 106 int32_t Release() override; |
104 int32_t Reset() override; | 107 int32_t Reset() override; |
105 bool PrefersLateDecoding() const override; | 108 bool PrefersLateDecoding() const override; |
106 | 109 |
| 110 const char* ImplementationName() const override; |
| 111 |
107 private: | 112 private: |
108 bool InitFallbackDecoder(); | 113 bool InitFallbackDecoder(); |
109 | 114 |
110 const DecoderType decoder_type_; | 115 const DecoderType decoder_type_; |
111 VideoDecoder* const decoder_; | 116 VideoDecoder* const decoder_; |
112 | 117 |
113 VideoCodec codec_settings_; | 118 VideoCodec codec_settings_; |
114 int32_t number_of_cores_; | 119 int32_t number_of_cores_; |
| 120 std::string fallback_implementation_name_; |
115 rtc::scoped_ptr<VideoDecoder> fallback_decoder_; | 121 rtc::scoped_ptr<VideoDecoder> fallback_decoder_; |
116 DecodedImageCallback* callback_; | 122 DecodedImageCallback* callback_; |
117 }; | 123 }; |
118 | 124 |
119 } // namespace webrtc | 125 } // namespace webrtc |
120 | 126 |
121 #endif // WEBRTC_VIDEO_DECODER_H_ | 127 #endif // WEBRTC_VIDEO_DECODER_H_ |
OLD | NEW |