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

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: Retake using bool. 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
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
21 namespace content { 23 namespace content {
(...skipping 27 matching lines...) Expand all
49 ~VideoTrackRecorder() override; 51 ~VideoTrackRecorder() override;
50 52
51 void Pause(); 53 void Pause();
52 void Resume(); 54 void Resume();
53 55
54 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, 56 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame,
55 base::TimeTicks capture_time); 57 base::TimeTicks capture_time);
56 private: 58 private:
57 friend class VideoTrackRecorderTest; 59 friend class VideoTrackRecorderTest;
58 60
61 void ReceiveFirstFrameOnIOThread(
62 const scoped_refptr<media::VideoFrame>& frame,
63 base::TimeTicks capture_time);
64 void InitializeEncoderOnMainThread(
65 const scoped_refptr<media::VideoFrame>& frame,
66 base::TimeTicks capture_time);
67
59 // Used to check that we are destroyed on the same thread we were created. 68 // Used to check that we are destroyed on the same thread we were created.
60 base::ThreadChecker main_render_thread_checker_; 69 base::ThreadChecker main_render_thread_checker_;
61 70
71 // Used to post initialization on the same thread we were created.
72 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
73
74 // Task runner where frame encode callbacks must happen.
75 scoped_refptr<base::SingleThreadTaskRunner> origin_task_runner_;
76
62 // We need to hold on to the Blink track to remove ourselves on dtor. 77 // We need to hold on to the Blink track to remove ourselves on dtor.
63 blink::WebMediaStreamTrack track_; 78 blink::WebMediaStreamTrack track_;
64 79
65 // Inner class to encode using whichever codec is configured. 80 // Inner class to encode using whichever codec is configured.
66 scoped_refptr<Encoder> encoder_; 81 scoped_refptr<Encoder> encoder_;
67 82
83 // Parameters that would be passed to the underlying |encoder_|.
84 const CodecId codec_;
85 const OnEncodedVideoCB on_encoded_video_callback_;
86 const int32_t bits_per_second_;
87
88 // Used to track the paused state during the initialization process.
89 bool paused_before_init_;
90
91 // Used to mark that initialization task is posted.
92 bool is_first_frame_received_for_initialization_;
93
94 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_;
95
68 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); 96 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder);
69 }; 97 };
70 98
71 } // namespace content 99 } // namespace content
72 #endif // CONTENT_RENDERER_MEDIA_VIDEO_TRACK_RECORDER_H_ 100 #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') | content/renderer/media/video_track_recorder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698