Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1414)

Unified Diff: webrtc/video/video_decoder.cc

Issue 1657023002: Implement NullVideoDecoder to avoid crash on unsupported decoders. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Feedback Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2.cc ('k') | webrtc/video_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/video_decoder.cc
diff --git a/webrtc/video/video_decoder.cc b/webrtc/video/video_decoder.cc
index d699175274d54630d14003b613a4651edace018a..a97b4cc25946fd5b09635d8f5798772a7c008af3 100644
--- a/webrtc/video/video_decoder.cc
+++ b/webrtc/video/video_decoder.cc
@@ -27,8 +27,8 @@ VideoDecoder* VideoDecoder::Create(VideoDecoder::DecoderType codec_type) {
case kVp9:
return VP9Decoder::Create();
case kUnsupportedCodec:
- RTC_NOTREACHED();
- return nullptr;
+ LOG(LS_ERROR) << "Creating NullVideoDecoder for unsupported codec.";
+ return new NullVideoDecoder();
}
RTC_NOTREACHED();
return nullptr;
@@ -146,4 +146,40 @@ const char* VideoDecoderSoftwareFallbackWrapper::ImplementationName() const {
return decoder_->ImplementationName();
}
+NullVideoDecoder::NullVideoDecoder() {}
+
+int32_t NullVideoDecoder::InitDecode(const VideoCodec* codec_settings,
+ int32_t number_of_cores) {
+ LOG(LS_ERROR) << "Can't initialize NullVideoDecoder.";
+ return WEBRTC_VIDEO_CODEC_OK;
+}
+
+int32_t NullVideoDecoder::Decode(const EncodedImage& input_image,
+ bool missing_frames,
+ const RTPFragmentationHeader* fragmentation,
+ const CodecSpecificInfo* codec_specific_info,
+ int64_t render_time_ms) {
+ LOG(LS_ERROR) << "The NullVideoDecoder doesn't support decoding.";
+ return WEBRTC_VIDEO_CODEC_OK;
+}
+
+int32_t NullVideoDecoder::RegisterDecodeCompleteCallback(
+ DecodedImageCallback* callback) {
+ LOG(LS_ERROR)
+ << "Can't register decode complete callback on NullVideoDecoder.";
+ return WEBRTC_VIDEO_CODEC_OK;
+}
+
+int32_t NullVideoDecoder::Release() {
+ return WEBRTC_VIDEO_CODEC_OK;
+}
+
+int32_t NullVideoDecoder::Reset() {
+ return WEBRTC_VIDEO_CODEC_OK;
+}
+
+const char* NullVideoDecoder::ImplementationName() const {
+ return "NullVideoDecoder";
+}
+
} // namespace webrtc
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2.cc ('k') | webrtc/video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698