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

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

Issue 2805353002: Merge 58: Handle HW encoder errors in VideoTrackRecorder (Closed)
Patch Set: Created 3 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 | « no previous file | content/renderer/media_recorder/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_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"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #endif 46 #endif
47 LAST 47 LAST
48 }; 48 };
49 class Encoder; 49 class Encoder;
50 50
51 using OnEncodedVideoCB = 51 using OnEncodedVideoCB =
52 base::Callback<void(const media::WebmMuxer::VideoParameters& params, 52 base::Callback<void(const media::WebmMuxer::VideoParameters& params,
53 std::unique_ptr<std::string> encoded_data, 53 std::unique_ptr<std::string> encoded_data,
54 base::TimeTicks capture_timestamp, 54 base::TimeTicks capture_timestamp,
55 bool is_key_frame)>; 55 bool is_key_frame)>;
56 using OnErrorCB = base::Closure;
56 57
57 static CodecId GetPreferredCodecId(); 58 static CodecId GetPreferredCodecId();
58 59
59 VideoTrackRecorder(CodecId codec, 60 VideoTrackRecorder(CodecId codec,
60 const blink::WebMediaStreamTrack& track, 61 const blink::WebMediaStreamTrack& track,
61 const OnEncodedVideoCB& on_encoded_video_cb, 62 const OnEncodedVideoCB& on_encoded_video_cb,
62 int32_t bits_per_second); 63 int32_t bits_per_second);
63 ~VideoTrackRecorder() override; 64 ~VideoTrackRecorder() override;
64 65
65 void Pause(); 66 void Pause();
66 void Resume(); 67 void Resume();
67 68
68 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, 69 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame,
69 base::TimeTicks capture_time); 70 base::TimeTicks capture_time);
70 private: 71 private:
71 friend class VideoTrackRecorderTest; 72 friend class VideoTrackRecorderTest;
72 73
73 void InitializeEncoder(CodecId codec, 74 void InitializeEncoder(CodecId codec,
74 const OnEncodedVideoCB& on_encoded_video_callback, 75 const OnEncodedVideoCB& on_encoded_video_callback,
75 int32_t bits_per_second, 76 int32_t bits_per_second,
77 bool allow_vea_encoder,
76 const scoped_refptr<media::VideoFrame>& frame, 78 const scoped_refptr<media::VideoFrame>& frame,
77 base::TimeTicks capture_time); 79 base::TimeTicks capture_time);
80 void OnError();
78 81
79 // Used to check that we are destroyed on the same thread we were created. 82 // Used to check that we are destroyed on the same thread we were created.
80 base::ThreadChecker main_render_thread_checker_; 83 base::ThreadChecker main_render_thread_checker_;
81 84
82 // We need to hold on to the Blink track to remove ourselves on dtor. 85 // We need to hold on to the Blink track to remove ourselves on dtor.
83 blink::WebMediaStreamTrack track_; 86 blink::WebMediaStreamTrack track_;
84 87
85 // Inner class to encode using whichever codec is configured. 88 // Inner class to encode using whichever codec is configured.
86 scoped_refptr<Encoder> encoder_; 89 scoped_refptr<Encoder> encoder_;
87 90
88 base::Callback<void(const scoped_refptr<media::VideoFrame>& frame, 91 base::Callback<void(bool allow_vea_encoder,
92 const scoped_refptr<media::VideoFrame>& frame,
89 base::TimeTicks capture_time)> 93 base::TimeTicks capture_time)>
90 initialize_encoder_callback_; 94 initialize_encoder_callback_;
91 95
92 // Used to track the paused state during the initialization process. 96 // Used to track the paused state during the initialization process.
93 bool paused_before_init_; 97 bool paused_before_init_;
94 98
95 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_; 99 base::WeakPtrFactory<VideoTrackRecorder> weak_ptr_factory_;
96 100
97 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder); 101 DISALLOW_COPY_AND_ASSIGN(VideoTrackRecorder);
98 }; 102 };
99 103
100 } // namespace content 104 } // namespace content
101 #endif // CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_ 105 #endif // CONTENT_RENDERER_MEDIA_RECORDER_VIDEO_TRACK_RECORDER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media_recorder/video_track_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698