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

Side by Side Diff: content/renderer/media_recorder/video_track_recorder.h

Issue 2844453003: Revert of Android: enable H264&VP8 HW accelerator for MediaRecorder (Closed)
Patch Set: rebase Created 3 years, 7 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_
6 #define CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ 6 #define CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "content/public/common/features.h" 15 #include "content/public/common/features.h"
16 #include "content/public/renderer/media_stream_video_sink.h" 16 #include "content/public/renderer/media_stream_video_sink.h"
17 #include "media/muxers/webm_muxer.h" 17 #include "media/muxers/webm_muxer.h"
18 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 18 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
19 #include "third_party/skia/include/core/SkBitmap.h" 19 #include "third_party/skia/include/core/SkBitmap.h"
20 20
21 #if BUILDFLAG(RTC_USE_H264) || defined(OS_ANDROID)
22 // H264 encoding is supported on Android using the platform encode
23 // accelerator, and elsewhere using OpenH264.
24 #define IS_H264_SUPPORTED
25 #endif
26
27 namespace base { 21 namespace base {
28 class Thread; 22 class Thread;
29 } // namespace base 23 } // namespace base
30 24
31 namespace cc { 25 namespace cc {
32 class PaintCanvas; 26 class PaintCanvas;
33 } // namespace cc 27 } // namespace cc
34 28
35 namespace media { 29 namespace media {
36 class SkCanvasVideoRenderer; 30 class SkCanvasVideoRenderer;
37 class VideoFrame; 31 class VideoFrame;
38 } // namespace media 32 } // namespace media
39 33
40 namespace video_track_recorder { 34 namespace video_track_recorder {
41 #if defined(OS_ANDROID)
42 const int kVEAEncoderMinResolutionWidth = 176;
43 const int kVEAEncoderMinResolutionHeight = 144;
44 #else
45 const int kVEAEncoderMinResolutionWidth = 640; 35 const int kVEAEncoderMinResolutionWidth = 640;
46 const int kVEAEncoderMinResolutionHeight = 480; 36 const int kVEAEncoderMinResolutionHeight = 480;
47 #endif
48 } // namespace video_track_recorder 37 } // namespace video_track_recorder
49 38
50 namespace content { 39 namespace content {
51 40
52 // VideoTrackRecorder is a MediaStreamVideoSink that encodes the video frames 41 // VideoTrackRecorder is a MediaStreamVideoSink that encodes the video frames
53 // received from a Stream Video Track. This class is constructed and used on a 42 // received from a Stream Video Track. This class is constructed and used on a
54 // single thread, namely the main Render thread. This mirrors the other 43 // single thread, namely the main Render thread. This mirrors the other
55 // MediaStreamVideo* classes that are constructed/configured on Main Render 44 // MediaStreamVideo* classes that are constructed/configured on Main Render
56 // thread but that pass frames on Render IO thread. It has an internal Encoder 45 // thread but that pass frames on Render IO thread. It has an internal Encoder
57 // with its own threading subtleties, see the implementation file. 46 // with its own threading subtleties, see the implementation file.
58 class CONTENT_EXPORT VideoTrackRecorder 47 class CONTENT_EXPORT VideoTrackRecorder
59 : NON_EXPORTED_BASE(public MediaStreamVideoSink) { 48 : NON_EXPORTED_BASE(public MediaStreamVideoSink) {
60 public: 49 public:
61 // Do not change the order of codecs; add new ones right before LAST. 50 // Do not change the order of codecs; add new ones right before LAST.
62 enum class CodecId { 51 enum class CodecId {
63 VP8, 52 VP8,
64 VP9, 53 VP9,
65 #if defined(IS_H264_SUPPORTED) 54 #if BUILDFLAG(RTC_USE_H264)
66 H264, 55 H264,
67 #endif 56 #endif
68 LAST 57 LAST
69 }; 58 };
70 59
71 using OnEncodedVideoCB = 60 using OnEncodedVideoCB =
72 base::Callback<void(const media::WebmMuxer::VideoParameters& params, 61 base::Callback<void(const media::WebmMuxer::VideoParameters& params,
73 std::unique_ptr<std::string> encoded_data, 62 std::unique_ptr<std::string> encoded_data,
74 std::unique_ptr<std::string> encoded_alpha, 63 std::unique_ptr<std::string> encoded_alpha,
75 base::TimeTicks capture_timestamp, 64 base::TimeTicks capture_timestamp,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Used to track the paused state during the initialization process. 189 // Used to track the paused state during the initialization process.
201 bool paused_before_init_; 190 bool paused_before_init_;
202 191
203 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_; 192 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_;
204 193
205 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); 194 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder);
206 }; 195 };
207 196
208 } // namespace content 197 } // namespace content
209 #endif // CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ 198 #endif // CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_
OLDNEW
« no previous file with comments | « content/renderer/media_recorder/media_recorder_handler.cc ('k') | content/renderer/media_recorder/video_track_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698