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

Side by Side Diff: content/renderer/pepper/video_encoder_shim.h

Issue 956893002: content: pepper: VideoEncoder: add software encoder support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another android dep fix Created 5 years, 9 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 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_PEPPER_VIDEO_ENCODER_SHIM_H_
6 #define CONTENT_RENDERER_PEPPER_VIDEO_ENCODER_SHIM_H_
7
8 #include <vector>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "media/video/video_encode_accelerator.h"
13
14 namespace base {
15 class SingleThreadTaskRunner;
16 }
17
18 namespace gfx {
19 class Size;
20 }
21
22 namespace content {
23
24 class PepperVideoEncoderHost;
25
26 // This class is a shim to wrap a media::cast::SoftwareVideoEncoder so that it
27 // can be used by PepperVideoEncoderHost in place of a
28 // media::VideoEncodeAccelerator. This class should be constructed, used, and
29 // destructed on the main (render) thread.
30 class VideoEncoderShim : public media::VideoEncodeAccelerator {
31 public:
32 explicit VideoEncoderShim(PepperVideoEncoderHost* host);
33 ~VideoEncoderShim() override;
34
35 // media::VideoEncodeAccelerator implementation.
36 std::vector<media::VideoEncodeAccelerator::SupportedProfile>
37 GetSupportedProfiles() override;
38 bool Initialize(media::VideoFrame::Format input_format,
39 const gfx::Size& input_visible_size,
40 media::VideoCodecProfile output_profile,
41 uint32 initial_bitrate,
42 media::VideoEncodeAccelerator::Client* client) override;
43 void Encode(const scoped_refptr<media::VideoFrame>& frame,
44 bool force_keyframe) override;
45 void UseOutputBitstreamBuffer(const media::BitstreamBuffer& buffer) override;
46 void RequestEncodingParametersChange(uint32 bitrate,
47 uint32 framerate) override;
48 void Destroy() override;
49
50 private:
51 class EncoderImpl;
52
53 void OnRequireBitstreamBuffers(unsigned int input_count,
54 const gfx::Size& input_coded_size,
55 size_t output_buffer_size);
56 void OnBitstreamBufferReady(scoped_refptr<media::VideoFrame> frame,
57 int32 bitstream_buffer_id,
58 size_t payload_size,
59 bool key_frame);
60 void OnNotifyError(media::VideoEncodeAccelerator::Error error);
61
62 scoped_ptr<EncoderImpl> encoder_impl_;
63
64 PepperVideoEncoderHost* host_;
65
66 // Task doing the encoding.
67 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
68
69 base::WeakPtrFactory<VideoEncoderShim> weak_ptr_factory_;
70
71 DISALLOW_COPY_AND_ASSIGN(VideoEncoderShim);
72 };
73
74 } // namespace content
75
76 #endif // CONTENT_RENDERER_PEPPER_VIDEO_ENCODER_SHIM_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_video_encoder_host.cc ('k') | content/renderer/pepper/video_encoder_shim.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698