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

Side by Side Diff: talk/app/webrtc/androidvideocapturer.cc

Issue 1395673003: Native changes for VideoCapturerAndroid surface texture support (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 const cricket::CapturedFrame* GetCapturedFrame() const { 74 const cricket::CapturedFrame* GetCapturedFrame() const {
75 return &captured_frame_; 75 return &captured_frame_;
76 } 76 }
77 77
78 cricket::VideoFrame* CreateAliasedFrame( 78 cricket::VideoFrame* CreateAliasedFrame(
79 const cricket::CapturedFrame* captured_frame, 79 const cricket::CapturedFrame* captured_frame,
80 int dst_width, 80 int dst_width,
81 int dst_height) const override { 81 int dst_height) const override {
82 // Check that captured_frame is actually our frame. 82 // Check that captured_frame is actually our frame.
83 RTC_CHECK(captured_frame == &captured_frame_); 83 RTC_CHECK(captured_frame == &captured_frame_);
84 RTC_CHECK(buffer_->native_handle() == nullptr);
85
84 rtc::scoped_ptr<cricket::VideoFrame> frame(new cricket::WebRtcVideoFrame( 86 rtc::scoped_ptr<cricket::VideoFrame> frame(new cricket::WebRtcVideoFrame(
85 ShallowCenterCrop(buffer_, dst_width, dst_height), 87 ShallowCenterCrop(buffer_, dst_width, dst_height),
86 captured_frame->time_stamp, captured_frame->GetRotation())); 88 captured_frame->time_stamp, captured_frame->GetRotation()));
87 // Caller takes ownership. 89 // Caller takes ownership.
88 // TODO(magjed): Change CreateAliasedFrame() to return a rtc::scoped_ptr. 90 // TODO(magjed): Change CreateAliasedFrame() to return a rtc::scoped_ptr.
89 return apply_rotation_ ? frame->GetCopyWithRotationApplied()->Copy() 91 return apply_rotation_ ? frame->GetCopyWithRotationApplied()->Copy()
90 : frame.release(); 92 : frame.release();
91 } 93 }
92 94
95 cricket::VideoFrame* CreateAliasedFrame(
96 const cricket::CapturedFrame* input_frame,
97 int cropped_input_width,
98 int cropped_input_height,
99 int output_width,
100 int output_height) const override {
101 if (buffer_->native_handle() != nullptr) {
102 // TODO(perkj): Implement CreateAliasedFrame properly for textures.
103 rtc::scoped_ptr<cricket::VideoFrame> frame(new cricket::WebRtcVideoFrame(
104 buffer_, input_frame->time_stamp, input_frame->GetRotation()));
105 return frame.release();
106 }
107 return VideoFrameFactory::CreateAliasedFrame(input_frame,
108 cropped_input_width,
109 cropped_input_height,
110 output_width,
111 output_height);
112 }
113
93 private: 114 private:
94 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer_; 115 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer_;
95 cricket::CapturedFrame captured_frame_; 116 cricket::CapturedFrame captured_frame_;
96 rtc::scoped_refptr<AndroidVideoCapturerDelegate> delegate_; 117 rtc::scoped_refptr<AndroidVideoCapturerDelegate> delegate_;
97 }; 118 };
98 119
99 AndroidVideoCapturer::AndroidVideoCapturer( 120 AndroidVideoCapturer::AndroidVideoCapturer(
100 const rtc::scoped_refptr<AndroidVideoCapturerDelegate>& delegate) 121 const rtc::scoped_refptr<AndroidVideoCapturerDelegate>& delegate)
101 : running_(false), 122 : running_(false),
102 delegate_(delegate), 123 delegate_(delegate),
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 231
211 bool AndroidVideoCapturer::GetBestCaptureFormat( 232 bool AndroidVideoCapturer::GetBestCaptureFormat(
212 const cricket::VideoFormat& desired, 233 const cricket::VideoFormat& desired,
213 cricket::VideoFormat* best_format) { 234 cricket::VideoFormat* best_format) {
214 // Delegate this choice to VideoCapturerAndroid.startCapture(). 235 // Delegate this choice to VideoCapturerAndroid.startCapture().
215 *best_format = desired; 236 *best_format = desired;
216 return true; 237 return true;
217 } 238 }
218 239
219 } // namespace webrtc 240 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698