OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 #include "webrtc/video_decoder.h" | 11 #include "webrtc/video_decoder.h" |
12 | 12 |
13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
14 #include "webrtc/base/logging.h" | 14 #include "webrtc/base/logging.h" |
15 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 15 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
17 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 17 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 VideoDecoder* VideoDecoder::Create(VideoDecoder::DecoderType codec_type) { | 20 VideoDecoder* VideoDecoder::Create(VideoDecoder::DecoderType codec_type) { |
21 switch (codec_type) { | 21 switch (codec_type) { |
22 case kH264: | 22 case kH264: |
23 RTC_DCHECK(H264Decoder::IsSupported()); | 23 RTC_DCHECK(H264Decoder::IsSupported()); |
24 return H264Decoder::Create(); | 24 return H264Decoder::Create(); |
25 case kVp8: | 25 case kVp8: |
26 return VP8Decoder::Create(); | 26 return VP8Decoder::Create(); |
27 case kVp9: | 27 case kVp9: |
28 return VP9Decoder::Create(); | 28 return VP9Decoder::Create(); |
29 case kUnsupportedCodec: | 29 case kUnsupportedCodec: |
30 RTC_NOTREACHED(); | 30 LOG(LS_ERROR) << "Creating NullVideoDecoder for unsupported codec."; |
31 return nullptr; | 31 return new NullVideoDecoder(); |
32 } | 32 } |
33 RTC_NOTREACHED(); | 33 RTC_NOTREACHED(); |
34 return nullptr; | 34 return nullptr; |
35 } | 35 } |
36 | 36 |
37 VideoDecoder::DecoderType CodecTypeToDecoderType(VideoCodecType codec_type) { | 37 VideoDecoder::DecoderType CodecTypeToDecoderType(VideoCodecType codec_type) { |
38 switch (codec_type) { | 38 switch (codec_type) { |
39 case kVideoCodecH264: | 39 case kVideoCodecH264: |
40 return VideoDecoder::kH264; | 40 return VideoDecoder::kH264; |
41 case kVideoCodecVP8: | 41 case kVideoCodecVP8: |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return fallback_decoder_->PrefersLateDecoding(); | 139 return fallback_decoder_->PrefersLateDecoding(); |
140 return decoder_->PrefersLateDecoding(); | 140 return decoder_->PrefersLateDecoding(); |
141 } | 141 } |
142 | 142 |
143 const char* VideoDecoderSoftwareFallbackWrapper::ImplementationName() const { | 143 const char* VideoDecoderSoftwareFallbackWrapper::ImplementationName() const { |
144 if (fallback_decoder_) | 144 if (fallback_decoder_) |
145 return fallback_implementation_name_.c_str(); | 145 return fallback_implementation_name_.c_str(); |
146 return decoder_->ImplementationName(); | 146 return decoder_->ImplementationName(); |
147 } | 147 } |
148 | 148 |
| 149 NullVideoDecoder::NullVideoDecoder() {} |
| 150 |
| 151 int32_t NullVideoDecoder::InitDecode(const VideoCodec* codec_settings, |
| 152 int32_t number_of_cores) { |
| 153 LOG(LS_ERROR) << "Can't initialize NullVideoDecoder."; |
| 154 return WEBRTC_VIDEO_CODEC_OK; |
| 155 } |
| 156 |
| 157 int32_t NullVideoDecoder::Decode(const EncodedImage& input_image, |
| 158 bool missing_frames, |
| 159 const RTPFragmentationHeader* fragmentation, |
| 160 const CodecSpecificInfo* codec_specific_info, |
| 161 int64_t render_time_ms) { |
| 162 LOG(LS_ERROR) << "The NullVideoDecoder doesn't support decoding."; |
| 163 return WEBRTC_VIDEO_CODEC_OK; |
| 164 } |
| 165 |
| 166 int32_t NullVideoDecoder::RegisterDecodeCompleteCallback( |
| 167 DecodedImageCallback* callback) { |
| 168 LOG(LS_ERROR) |
| 169 << "Can't register decode complete callback on NullVideoDecoder."; |
| 170 return WEBRTC_VIDEO_CODEC_OK; |
| 171 } |
| 172 |
| 173 int32_t NullVideoDecoder::Release() { |
| 174 return WEBRTC_VIDEO_CODEC_OK; |
| 175 } |
| 176 |
| 177 int32_t NullVideoDecoder::Reset() { |
| 178 return WEBRTC_VIDEO_CODEC_OK; |
| 179 } |
| 180 |
| 181 const char* NullVideoDecoder::ImplementationName() const { |
| 182 return "NullVideoDecoder"; |
| 183 } |
| 184 |
149 } // namespace webrtc | 185 } // namespace webrtc |
OLD | NEW |