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

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

Issue 2000003002: Initialize based on frame sizes in VideoTrackRecorder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mrgpu2
Patch Set: Created 4 years, 5 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 | « no previous file | 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/memory/weak_ptr.h"
13 #include "base/single_thread_task_runner.h"
12 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
13 #include "content/public/common/features.h" 15 #include "content/public/common/features.h"
14 #include "content/public/renderer/media_stream_video_sink.h" 16 #include "content/public/renderer/media_stream_video_sink.h"
15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 17 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
16 18
17 namespace media { 19 namespace media {
18 class VideoFrame; 20 class VideoFrame;
19 } // namespace media 21 } // namespace media
20 22
23 namespace video_track_recorder {
24 const int kVEAEncoderMinResolutionWidth = 640;
25 const int kVEAEncoderMinResolutionHeight = 480;
26 } // namespace video_track_recorder
27
21 namespace content { 28 namespace content {
22 29
23 // VideoTrackRecorder is a MediaStreamVideoSink that encodes the video frames 30 // VideoTrackRecorder is a MediaStreamVideoSink that encodes the video frames
24 // received from a Stream Video Track. This class is constructed and used on a 31 // received from a Stream Video Track. This class is constructed and used on a
25 // single thread, namely the main Render thread. This mirrors the other 32 // single thread, namely the main Render thread. This mirrors the other
26 // MediaStreamVideo* classes that are constructed/configured on Main Render 33 // MediaStreamVideo* classes that are constructed/configured on Main Render
27 // thread but that pass frames on Render IO thread. It has an internal Encoder 34 // thread but that pass frames on Render IO thread. It has an internal Encoder
28 // with its own threading subtleties, see the implementation file. 35 // with its own threading subtleties, see the implementation file.
29 class CONTENT_EXPORT VideoTrackRecorder 36 class CONTENT_EXPORT VideoTrackRecorder
30 : NON_EXPORTED_BASE(public MediaStreamVideoSink) { 37 : NON_EXPORTED_BASE(public MediaStreamVideoSink) {
(...skipping 18 matching lines...) Expand all
49 ~VideoTrackRecorder() override; 56 ~VideoTrackRecorder() override;
50 57
51 void Pause(); 58 void Pause();
52 void Resume(); 59 void Resume();
53 60
54 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, 61 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame,
55 base::TimeTicks capture_time); 62 base::TimeTicks capture_time);
56 private: 63 private:
57 friend class VideoTrackRecorderTest; 64 friend class VideoTrackRecorderTest;
58 65
66 void InitializeEncoder(CodecId codec,
67 const OnEncodedVideoCB& on_encoded_video_callback,
68 int32_t bits_per_second,
69 const scoped_refptr<media::VideoFrame>& frame,
70 base::TimeTicks capture_time);
71
59 // Used to check that we are destroyed on the same thread we were created. 72 // Used to check that we are destroyed on the same thread we were created.
60 base::ThreadChecker main_render_thread_checker_; 73 base::ThreadChecker main_render_thread_checker_;
61 74
62 // We need to hold on to the Blink track to remove ourselves on dtor. 75 // We need to hold on to the Blink track to remove ourselves on dtor.
63 blink::WebMediaStreamTrack track_; 76 blink::WebMediaStreamTrack track_;
64 77
65 // Inner class to encode using whichever codec is configured. 78 // Inner class to encode using whichever codec is configured.
66 scoped_refptr<Encoder> encoder_; 79 scoped_refptr<Encoder> encoder_;
67 80
81 base::Callback<void(const scoped_refptr<media::VideoFrame>& frame,
82 base::TimeTicks capture_time)>
83 initialize_encoder_callback_;
mcasas 2016/07/12 15:41:12 Make const and put it in the initializer list inst
emircan 2016/07/12 17:39:24 I cannot. I use weak_ptr_factory_.GetWeakPtr() and
84
85 // Used to track the paused state during the initialization process.
86 bool paused_before_init_;
87
88 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_;
89
68 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); 90 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder);
69 }; 91 };
70 92
71 } // namespace content 93 } // namespace content
72 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ 94 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/video_track_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698