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

Side by Side Diff: talk/app/webrtc/objc/avfoundationvideocapturer.h

Issue 1838933004: Improve iOS frame capture threading. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix * Created 4 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 | talk/app/webrtc/objc/avfoundationvideocapturer.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 23 matching lines...) Expand all
34 #import <AVFoundation/AVFoundation.h> 34 #import <AVFoundation/AVFoundation.h>
35 35
36 @class RTCAVFoundationVideoCapturerInternal; 36 @class RTCAVFoundationVideoCapturerInternal;
37 37
38 namespace rtc { 38 namespace rtc {
39 class Thread; 39 class Thread;
40 } // namespace rtc 40 } // namespace rtc
41 41
42 namespace webrtc { 42 namespace webrtc {
43 43
44 class AVFoundationVideoCapturer : public cricket::VideoCapturer { 44 class AVFoundationVideoCapturer : public cricket::VideoCapturer,
45 public rtc::MessageHandler {
45 public: 46 public:
46 AVFoundationVideoCapturer(); 47 AVFoundationVideoCapturer();
47 ~AVFoundationVideoCapturer(); 48 ~AVFoundationVideoCapturer();
48 49
49 cricket::CaptureState Start(const cricket::VideoFormat& format) override; 50 cricket::CaptureState Start(const cricket::VideoFormat& format) override;
50 void Stop() override; 51 void Stop() override;
51 bool IsRunning() override; 52 bool IsRunning() override;
52 bool IsScreencast() const override { 53 bool IsScreencast() const override {
53 return false; 54 return false;
54 } 55 }
55 bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) override { 56 bool GetPreferredFourccs(std::vector<uint32_t>* fourccs) override {
56 fourccs->push_back(cricket::FOURCC_NV12); 57 fourccs->push_back(cricket::FOURCC_NV12);
57 return true; 58 return true;
58 } 59 }
59 60
60 // Returns the active capture session. 61 // Returns the active capture session. Calls to the capture session should
62 // occur on the RTCDispatcherTypeCaptureSession queue in RTCDispatcher.
61 AVCaptureSession* GetCaptureSession(); 63 AVCaptureSession* GetCaptureSession();
62 64
63 // Returns whether the rear-facing camera can be used. 65 // Returns whether the rear-facing camera can be used.
64 // e.g. It can't be used because it doesn't exist. 66 // e.g. It can't be used because it doesn't exist.
65 bool CanUseBackCamera() const; 67 bool CanUseBackCamera() const;
66 68
67 // Switches the camera being used (either front or back). 69 // Switches the camera being used (either front or back).
68 void SetUseBackCamera(bool useBackCamera); 70 void SetUseBackCamera(bool useBackCamera);
69 bool GetUseBackCamera() const; 71 bool GetUseBackCamera() const;
70 72
71 // Converts the sample buffer into a cricket::CapturedFrame and signals the 73 // Converts the sample buffer into a cricket::CapturedFrame and signals the
72 // frame for capture. 74 // frame for capture.
73 void CaptureSampleBuffer(CMSampleBufferRef sampleBuffer); 75 void CaptureSampleBuffer(CMSampleBufferRef sampleBuffer);
74 76
77 // Handles messages from posts.
78 void OnMessage(rtc::Message *msg) override;
79
75 private: 80 private:
76 // Used to signal frame capture on the thread that capturer was started on. 81 void OnFrameMessage(CVImageBufferRef image_buffer, int64_t capture_time);
77 void SignalFrameCapturedOnStartThread(const cricket::CapturedFrame* frame);
78 82
79 RTCAVFoundationVideoCapturerInternal* _capturer; 83 RTCAVFoundationVideoCapturerInternal* _capturer;
80 rtc::Thread* _startThread; // Set in Start(), unset in Stop(). 84 rtc::Thread* _startThread; // Set in Start(), unset in Stop().
81 }; // AVFoundationVideoCapturer 85 }; // AVFoundationVideoCapturer
82 86
83 } // namespace webrtc 87 } // namespace webrtc
84 88
85 #endif // TALK_APP_WEBRTC_OBJC_AVFOUNDATION_CAPTURER_H_ 89 #endif // TALK_APP_WEBRTC_OBJC_AVFOUNDATION_CAPTURER_H_
OLDNEW
« no previous file with comments | « no previous file | talk/app/webrtc/objc/avfoundationvideocapturer.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698