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

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

Issue 1884383002: VideoTrackRecorder: Adding inner class H264Encoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hbos@ comments: adding explicit dep to openh264 in content.gyp and content/renderer/BUILD.gn Created 4 years, 8 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
« no previous file with comments | « content/renderer/media/DEPS ('k') | content/renderer/media/video_track_recorder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_VIDEO_TRACK_RECORDER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_
6 #define CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ 6 #define CONTENT_RENDERER_MEDIA_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/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
13 #include "content/public/common/features.h"
13 #include "content/public/renderer/media_stream_video_sink.h" 14 #include "content/public/renderer/media_stream_video_sink.h"
14 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
15 16
16 namespace media { 17 namespace media {
17 class VideoFrame; 18 class VideoFrame;
18 } // namespace media 19 } // namespace media
19 20
20 namespace content { 21 namespace content {
21 22
22 // VideoTrackRecorder is a MediaStreamVideoSink that encodes the video frames 23 // VideoTrackRecorder is a MediaStreamVideoSink that encodes the video frames
23 // received from a Stream Video Track. This class is constructed and used on a 24 // received from a Stream Video Track. This class is constructed and used on a
24 // single thread, namely the main Render thread. This mirrors the other 25 // single thread, namely the main Render thread. This mirrors the other
25 // MediaStreamVideo* classes that are constructed/configured on Main Render 26 // MediaStreamVideo* classes that are constructed/configured on Main Render
26 // thread but that pass frames on Render IO thread. It has an internal Encoder 27 // thread but that pass frames on Render IO thread. It has an internal Encoder
27 // with its own threading subtleties, see the implementation file. 28 // with its own threading subtleties, see the implementation file.
28 class CONTENT_EXPORT VideoTrackRecorder 29 class CONTENT_EXPORT VideoTrackRecorder
29 : NON_EXPORTED_BASE(public MediaStreamVideoSink) { 30 : NON_EXPORTED_BASE(public MediaStreamVideoSink) {
30 public: 31 public:
31 enum class CodecId { 32 enum class CodecId {
32 VP8, 33 VP8,
33 VP9, 34 VP9,
35 #if BUILDFLAG(RTC_USE_H264)
36 H264,
37 #endif
34 }; 38 };
35 class Encoder; 39 class Encoder;
36 40
37 using OnEncodedVideoCB = 41 using OnEncodedVideoCB =
38 base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame, 42 base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame,
39 std::unique_ptr<std::string> encoded_data, 43 std::unique_ptr<std::string> encoded_data,
40 base::TimeTicks capture_timestamp, 44 base::TimeTicks capture_timestamp,
41 bool is_key_frame)>; 45 bool is_key_frame)>;
42 46
43 VideoTrackRecorder(CodecId codec, 47 VideoTrackRecorder(CodecId codec,
(...skipping 10 matching lines...) Expand all
54 private: 58 private:
55 friend class VideoTrackRecorderTest; 59 friend class VideoTrackRecorderTest;
56 60
57 // Used to check that we are destroyed on the same thread we were created. 61 // Used to check that we are destroyed on the same thread we were created.
58 base::ThreadChecker main_render_thread_checker_; 62 base::ThreadChecker main_render_thread_checker_;
59 63
60 // We need to hold on to the Blink track to remove ourselves on dtor. 64 // We need to hold on to the Blink track to remove ourselves on dtor.
61 blink::WebMediaStreamTrack track_; 65 blink::WebMediaStreamTrack track_;
62 66
63 // Inner class to encode using whichever codec is configured. 67 // Inner class to encode using whichever codec is configured.
64 const scoped_refptr<Encoder> encoder_; 68 scoped_refptr<Encoder> encoder_;
65 69
66 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); 70 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder);
67 }; 71 };
68 72
69 } // namespace content 73 } // namespace content
70 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ 74 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_
OLDNEW
« no previous file with comments | « content/renderer/media/DEPS ('k') | content/renderer/media/video_track_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698