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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 bool missing_frames, | 66 bool missing_frames, |
67 const RTPFragmentationHeader* fragmentation, | 67 const RTPFragmentationHeader* fragmentation, |
68 const CodecSpecificInfo* codec_specific_info = NULL, | 68 const CodecSpecificInfo* codec_specific_info = NULL, |
69 int64_t render_time_ms = -1) = 0; | 69 int64_t render_time_ms = -1) = 0; |
70 | 70 |
71 virtual int32_t RegisterDecodeCompleteCallback( | 71 virtual int32_t RegisterDecodeCompleteCallback( |
72 DecodedImageCallback* callback) = 0; | 72 DecodedImageCallback* callback) = 0; |
73 | 73 |
74 virtual int32_t Release() = 0; | 74 virtual int32_t Release() = 0; |
75 virtual int32_t Reset() = 0; | 75 virtual int32_t Reset() = 0; |
| 76 |
| 77 // 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 // frame is consumed. |
| 80 virtual bool PrefersLateDecoding() const { return true; } |
76 }; | 81 }; |
77 | 82 |
78 // Class used to wrap external VideoDecoders to provide a fallback option on | 83 // Class used to wrap external VideoDecoders to provide a fallback option on |
79 // software decoding when a hardware decoder fails to decode a stream due to | 84 // software decoding when a hardware decoder fails to decode a stream due to |
80 // hardware restrictions, such as max resolution. | 85 // hardware restrictions, such as max resolution. |
81 class VideoDecoderSoftwareFallbackWrapper : public webrtc::VideoDecoder { | 86 class VideoDecoderSoftwareFallbackWrapper : public webrtc::VideoDecoder { |
82 public: | 87 public: |
83 VideoDecoderSoftwareFallbackWrapper(VideoCodecType codec_type, | 88 VideoDecoderSoftwareFallbackWrapper(VideoCodecType codec_type, |
84 VideoDecoder* decoder); | 89 VideoDecoder* decoder); |
85 | 90 |
86 int32_t InitDecode(const VideoCodec* codec_settings, | 91 int32_t InitDecode(const VideoCodec* codec_settings, |
87 int32_t number_of_cores) override; | 92 int32_t number_of_cores) override; |
88 | 93 |
89 int32_t Decode(const EncodedImage& input_image, | 94 int32_t Decode(const EncodedImage& input_image, |
90 bool missing_frames, | 95 bool missing_frames, |
91 const RTPFragmentationHeader* fragmentation, | 96 const RTPFragmentationHeader* fragmentation, |
92 const CodecSpecificInfo* codec_specific_info, | 97 const CodecSpecificInfo* codec_specific_info, |
93 int64_t render_time_ms) override; | 98 int64_t render_time_ms) override; |
94 | 99 |
95 int32_t RegisterDecodeCompleteCallback( | 100 int32_t RegisterDecodeCompleteCallback( |
96 DecodedImageCallback* callback) override; | 101 DecodedImageCallback* callback) override; |
97 | 102 |
98 int32_t Release() override; | 103 int32_t Release() override; |
99 int32_t Reset() override; | 104 int32_t Reset() override; |
| 105 bool PrefersLateDecoding() const override; |
100 | 106 |
101 private: | 107 private: |
102 bool InitFallbackDecoder(); | 108 bool InitFallbackDecoder(); |
103 | 109 |
104 const DecoderType decoder_type_; | 110 const DecoderType decoder_type_; |
105 VideoDecoder* const decoder_; | 111 VideoDecoder* const decoder_; |
106 | 112 |
107 VideoCodec codec_settings_; | 113 VideoCodec codec_settings_; |
108 int32_t number_of_cores_; | 114 int32_t number_of_cores_; |
109 rtc::scoped_ptr<VideoDecoder> fallback_decoder_; | 115 rtc::scoped_ptr<VideoDecoder> fallback_decoder_; |
110 DecodedImageCallback* callback_; | 116 DecodedImageCallback* callback_; |
111 }; | 117 }; |
112 | 118 |
113 } // namespace webrtc | 119 } // namespace webrtc |
114 | 120 |
115 #endif // WEBRTC_VIDEO_DECODER_H_ | 121 #endif // WEBRTC_VIDEO_DECODER_H_ |
OLD | NEW |