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

Side by Side Diff: webrtc/video/video_decoder.cc

Issue 2521203002: Move VideoDecoder::Create() logic to separate internal video decoder factory (Closed)
Patch Set: Add unittest Created 4 years 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 unified diff | Download patch
« no previous file with comments | « webrtc/video/BUILD.gn ('k') | webrtc/video_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/video_decoder.h"
12
13 #include "webrtc/base/checks.h"
14 #include "webrtc/base/logging.h"
15 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
17 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h"
18
19 namespace webrtc {
20 VideoDecoder* VideoDecoder::Create(VideoDecoder::DecoderType codec_type) {
21 switch (codec_type) {
22 case kH264:
23 if (!H264Decoder::IsSupported()) {
24 // This could happen in a software-fallback for a codec type only
25 // supported externally (e.g. H.264 on iOS or Android) or in current
26 // usage in WebRtcVideoEngine2 if the external decoder fails to be
27 // created.
28 LOG(LS_ERROR) << "Unable to create an H.264 decoder fallback. "
29 << "Decoding of this stream will be broken.";
30 return new NullVideoDecoder();
31 }
32 return H264Decoder::Create();
33 case kVp8:
34 return VP8Decoder::Create();
35 case kVp9:
36 RTC_DCHECK(VP9Decoder::IsSupported());
37 return VP9Decoder::Create();
38 case kUnsupportedCodec:
39 LOG(LS_ERROR) << "Creating NullVideoDecoder for unsupported codec.";
40 return new NullVideoDecoder();
41 }
42 RTC_NOTREACHED();
43 return nullptr;
44 }
45
46 NullVideoDecoder::NullVideoDecoder() {}
47
48 int32_t NullVideoDecoder::InitDecode(const VideoCodec* codec_settings,
49 int32_t number_of_cores) {
50 LOG(LS_ERROR) << "Can't initialize NullVideoDecoder.";
51 return WEBRTC_VIDEO_CODEC_OK;
52 }
53
54 int32_t NullVideoDecoder::Decode(const EncodedImage& input_image,
55 bool missing_frames,
56 const RTPFragmentationHeader* fragmentation,
57 const CodecSpecificInfo* codec_specific_info,
58 int64_t render_time_ms) {
59 LOG(LS_ERROR) << "The NullVideoDecoder doesn't support decoding.";
60 return WEBRTC_VIDEO_CODEC_OK;
61 }
62
63 int32_t NullVideoDecoder::RegisterDecodeCompleteCallback(
64 DecodedImageCallback* callback) {
65 LOG(LS_ERROR)
66 << "Can't register decode complete callback on NullVideoDecoder.";
67 return WEBRTC_VIDEO_CODEC_OK;
68 }
69
70 int32_t NullVideoDecoder::Release() {
71 return WEBRTC_VIDEO_CODEC_OK;
72 }
73
74 const char* NullVideoDecoder::ImplementationName() const {
75 return "NullVideoDecoder";
76 }
77
78 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/BUILD.gn ('k') | webrtc/video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698