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

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: Removed DCHECK / NOTREACHED. 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..d1f109e258b95e22c8584867b4c74eb7de6b0ccf 100644
--- a/webrtc/video/video_decoder.cc
+++ b/webrtc/video/video_decoder.cc
@@ -27,8 +27,7 @@ VideoDecoder* VideoDecoder::Create(VideoDecoder::DecoderType codec_type) {
case kVp9:
return VP9Decoder::Create();
case kUnsupportedCodec:
- RTC_NOTREACHED();
- return nullptr;
+ return new NullVideoDecoder();
pbos-webrtc 2016/02/02 13:59:13 I'd prefer a log here as well.
joachim 2016/02/02 14:31:33 Done.
}
RTC_NOTREACHED();
return nullptr;
@@ -146,4 +145,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 "null";
noahric 2016/02/02 14:06:43 Maybe NullVideoDecoder, so the logging doesn't loo
joachim 2016/02/02 14:31:33 Done.
+}
+
} // 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