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

Side by Side Diff: content/renderer/media/webrtc/webrtc_video_frame_adapter.h

Issue 2456443002: Add callback to copy texture backed frames in WebRtcVideoFrameAdapter (Closed)
Patch Set: mcasas@ comments. Created 4 years, 1 month 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_WEBRTC_WEBRTC_VIDEO_FRAME_ADAPTER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_FRAME_ADAPTER_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_FRAME_ADAPTER_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_FRAME_ADAPTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/callback.h"
10 #include "media/base/video_frame.h" 11 #include "media/base/video_frame.h"
11 #include "third_party/webrtc/common_video/include/video_frame_buffer.h" 12 #include "third_party/webrtc/common_video/include/video_frame_buffer.h"
12 13
13 namespace content { 14 namespace content {
14 // Thin adapter from media::VideoFrame to webrtc::VideoFrameBuffer. This 15 // Thin adapter from media::VideoFrame to webrtc::VideoFrameBuffer. This
15 // implementation is read-only and will return null if trying to get a 16 // implementation is read-only and will return null if trying to get a
16 // non-const pointer to the pixel data. This object will be accessed from 17 // non-const pointer to the pixel data. This object will be accessed from
17 // different threads, but that's safe since it's read-only. 18 // different threads, but that's safe since it's read-only.
18 class WebRtcVideoFrameAdapter : public webrtc::VideoFrameBuffer { 19 class WebRtcVideoFrameAdapter : public webrtc::VideoFrameBuffer {
19 public: 20 public:
20 explicit WebRtcVideoFrameAdapter( 21 using CopyTextureFrameCallback =
21 const scoped_refptr<media::VideoFrame>& frame); 22 base::Callback<void(const scoped_refptr<media::VideoFrame>&,
23 scoped_refptr<media::VideoFrame>*)>;
24
25 WebRtcVideoFrameAdapter(
26 const scoped_refptr<media::VideoFrame>& frame,
27 const CopyTextureFrameCallback& copy_texture_callback);
22 28
23 private: 29 private:
24 int width() const override; 30 int width() const override;
25 int height() const override; 31 int height() const override;
26 32
27 const uint8_t* DataY() const override; 33 const uint8_t* DataY() const override;
28 const uint8_t* DataU() const override; 34 const uint8_t* DataU() const override;
29 const uint8_t* DataV() const override; 35 const uint8_t* DataV() const override;
30 36
31 int StrideY() const override; 37 int StrideY() const override;
32 int StrideU() const override; 38 int StrideU() const override;
33 int StrideV() const override; 39 int StrideV() const override;
34 40
35 void* native_handle() const override; 41 void* native_handle() const override;
36 42
37 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; 43 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
38 44
39 friend class rtc::RefCountedObject<WebRtcVideoFrameAdapter>; 45 friend class rtc::RefCountedObject<WebRtcVideoFrameAdapter>;
40 46
41 protected: 47 protected:
42 ~WebRtcVideoFrameAdapter() override; 48 ~WebRtcVideoFrameAdapter() override;
43 49
44 scoped_refptr<media::VideoFrame> frame_; 50 scoped_refptr<media::VideoFrame> frame_;
51 const CopyTextureFrameCallback copy_texture_callback_;
45 }; 52 };
46 53
47 } // namespace content 54 } // namespace content
48 55
49 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_FRAME_ADAPTER_H_ 56 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_WEBRTC_VIDEO_FRAME_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698