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

Side by Side Diff: webrtc/media/engine/scopedvideodecoder.cc

Issue 3010953002: Revert of Prepare for injectable SW decoders (Closed)
Patch Set: Created 3 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 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/media/engine/scopedvideodecoder.h"
12
13 #include <vector>
14
15 #include "webrtc/api/video_codecs/video_decoder.h"
16
17 namespace cricket {
18
19 namespace {
20
21 class ScopedVideoDecoder : public webrtc::VideoDecoder {
22 public:
23 ScopedVideoDecoder(WebRtcVideoDecoderFactory* factory,
24 webrtc::VideoDecoder* decoder);
25
26 int32_t InitDecode(const webrtc::VideoCodec* codec_settings,
27 int32_t number_of_cores) override;
28 int32_t RegisterDecodeCompleteCallback(
29 webrtc::DecodedImageCallback* callback) override;
30 int32_t Release() override;
31 int32_t Decode(const webrtc::EncodedImage& input_image,
32 bool missing_frames,
33 const webrtc::RTPFragmentationHeader* fragmentation,
34 const webrtc::CodecSpecificInfo* codec_specific_info,
35 int64_t render_time_ms) override;
36 bool PrefersLateDecoding() const override;
37 const char* ImplementationName() const override;
38
39 ~ScopedVideoDecoder() override;
40
41 private:
42 WebRtcVideoDecoderFactory* factory_;
43 webrtc::VideoDecoder* decoder_;
44 };
45
46 ScopedVideoDecoder::ScopedVideoDecoder(WebRtcVideoDecoderFactory* factory,
47 webrtc::VideoDecoder* decoder)
48 : factory_(factory), decoder_(decoder) {}
49
50 int32_t ScopedVideoDecoder::InitDecode(const webrtc::VideoCodec* codec_settings,
51 int32_t number_of_cores) {
52 return decoder_->InitDecode(codec_settings, number_of_cores);
53 }
54
55 int32_t ScopedVideoDecoder::RegisterDecodeCompleteCallback(
56 webrtc::DecodedImageCallback* callback) {
57 return decoder_->RegisterDecodeCompleteCallback(callback);
58 }
59
60 int32_t ScopedVideoDecoder::Release() {
61 return decoder_->Release();
62 }
63
64 int32_t ScopedVideoDecoder::Decode(
65 const webrtc::EncodedImage& input_image,
66 bool missing_frames,
67 const webrtc::RTPFragmentationHeader* fragmentation,
68 const webrtc::CodecSpecificInfo* codec_specific_info,
69 int64_t render_time_ms) {
70 return decoder_->Decode(input_image, missing_frames, fragmentation,
71 codec_specific_info, render_time_ms);
72 }
73
74 bool ScopedVideoDecoder::PrefersLateDecoding() const {
75 return decoder_->PrefersLateDecoding();
76 }
77
78 const char* ScopedVideoDecoder::ImplementationName() const {
79 return decoder_->ImplementationName();
80 }
81
82 ScopedVideoDecoder::~ScopedVideoDecoder() {
83 factory_->DestroyVideoDecoder(decoder_);
84 }
85
86 } // namespace
87
88 std::unique_ptr<webrtc::VideoDecoder> CreateScopedVideoDecoder(
89 WebRtcVideoDecoderFactory* factory,
90 webrtc::VideoCodecType type) {
91 webrtc::VideoDecoder* decoder = factory->CreateVideoDecoder(type);
92 if (!decoder)
93 return nullptr;
94 return std::unique_ptr<webrtc::VideoDecoder>(
95 new ScopedVideoDecoder(factory, decoder));
96 }
97
98 std::unique_ptr<webrtc::VideoDecoder> CreateScopedVideoDecoder(
99 WebRtcVideoDecoderFactory* factory,
100 webrtc::VideoCodecType type,
101 VideoDecoderParams params) {
102 webrtc::VideoDecoder* decoder =
103 factory->CreateVideoDecoderWithParams(type, params);
104 if (!decoder)
105 return nullptr;
106 return std::unique_ptr<webrtc::VideoDecoder>(
107 new ScopedVideoDecoder(factory, decoder));
108 }
109
110 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/scopedvideodecoder.h ('k') | webrtc/media/engine/videodecodersoftwarefallbackwrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698