OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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/media/engine/videodecodersoftwarefallbackwrapper.h" | 11 #include "webrtc/media/engine/videodecodersoftwarefallbackwrapper.h" |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 #include "webrtc/base/logging.h" | 16 #include "webrtc/base/logging.h" |
| 17 #include "webrtc/base/trace_event.h" |
17 #include "webrtc/media/engine/internaldecoderfactory.h" | 18 #include "webrtc/media/engine/internaldecoderfactory.h" |
18 #include "webrtc/modules/video_coding/include/video_error_codes.h" | 19 #include "webrtc/modules/video_coding/include/video_error_codes.h" |
19 | 20 |
20 namespace webrtc { | 21 namespace webrtc { |
21 | 22 |
22 VideoDecoderSoftwareFallbackWrapper::VideoDecoderSoftwareFallbackWrapper( | 23 VideoDecoderSoftwareFallbackWrapper::VideoDecoderSoftwareFallbackWrapper( |
23 VideoCodecType codec_type, | 24 VideoCodecType codec_type, |
24 VideoDecoder* decoder) | 25 VideoDecoder* decoder) |
25 : codec_type_(codec_type), | 26 : codec_type_(codec_type), |
26 decoder_(decoder), | 27 decoder_(decoder), |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 " (fallback from: " + decoder_->ImplementationName() + ")"; | 69 " (fallback from: " + decoder_->ImplementationName() + ")"; |
69 return true; | 70 return true; |
70 } | 71 } |
71 | 72 |
72 int32_t VideoDecoderSoftwareFallbackWrapper::Decode( | 73 int32_t VideoDecoderSoftwareFallbackWrapper::Decode( |
73 const EncodedImage& input_image, | 74 const EncodedImage& input_image, |
74 bool missing_frames, | 75 bool missing_frames, |
75 const RTPFragmentationHeader* fragmentation, | 76 const RTPFragmentationHeader* fragmentation, |
76 const CodecSpecificInfo* codec_specific_info, | 77 const CodecSpecificInfo* codec_specific_info, |
77 int64_t render_time_ms) { | 78 int64_t render_time_ms) { |
| 79 TRACE_EVENT0("webrtc", "VideoDecoderSoftwareFallbackWrapper::Decode"); |
78 // Try initializing and decoding with the provided decoder on every keyframe | 80 // Try initializing and decoding with the provided decoder on every keyframe |
79 // or when there's no fallback decoder. This is the normal case. | 81 // or when there's no fallback decoder. This is the normal case. |
80 if (!fallback_decoder_ || input_image._frameType == kVideoFrameKey) { | 82 if (!fallback_decoder_ || input_image._frameType == kVideoFrameKey) { |
81 int32_t ret = WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE; | 83 int32_t ret = WEBRTC_VIDEO_CODEC_FALLBACK_SOFTWARE; |
82 // Try reinitializing the decoder if it had failed before. | 84 // Try reinitializing the decoder if it had failed before. |
83 if (!decoder_initialized_) { | 85 if (!decoder_initialized_) { |
84 decoder_initialized_ = | 86 decoder_initialized_ = |
85 decoder_->InitDecode(&codec_settings_, number_of_cores_) == | 87 decoder_->InitDecode(&codec_settings_, number_of_cores_) == |
86 WEBRTC_VIDEO_CODEC_OK; | 88 WEBRTC_VIDEO_CODEC_OK; |
87 } | 89 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 return decoder_->PrefersLateDecoding(); | 138 return decoder_->PrefersLateDecoding(); |
137 } | 139 } |
138 | 140 |
139 const char* VideoDecoderSoftwareFallbackWrapper::ImplementationName() const { | 141 const char* VideoDecoderSoftwareFallbackWrapper::ImplementationName() const { |
140 if (fallback_decoder_) | 142 if (fallback_decoder_) |
141 return fallback_implementation_name_.c_str(); | 143 return fallback_implementation_name_.c_str(); |
142 return decoder_->ImplementationName(); | 144 return decoder_->ImplementationName(); |
143 } | 145 } |
144 | 146 |
145 } // namespace webrtc | 147 } // namespace webrtc |
OLD | NEW |