| OLD | NEW |
| 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 #include "chrome/renderer/media/cast_receiver_session.h" | 5 #include "chrome/renderer/media/cast_receiver_session.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 scoped_refptr<CastReceiverAudioValve> audio_valve_; | 37 scoped_refptr<CastReceiverAudioValve> audio_valve_; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 // This is a render thread object. | 40 // This is a render thread object. |
| 41 class CastReceiverSession::VideoCapturerSource | 41 class CastReceiverSession::VideoCapturerSource |
| 42 : public media::VideoCapturerSource { | 42 : public media::VideoCapturerSource { |
| 43 public: | 43 public: |
| 44 explicit VideoCapturerSource( | 44 explicit VideoCapturerSource( |
| 45 const scoped_refptr<CastReceiverSession> cast_receiver_session); | 45 const scoped_refptr<CastReceiverSession> cast_receiver_session); |
| 46 protected: | 46 protected: |
| 47 void GetCurrentSupportedFormats( | 47 media::VideoCaptureFormats GetPreferredFormats() override; |
| 48 int max_requested_width, | |
| 49 int max_requested_height, | |
| 50 double max_requested_frame_rate, | |
| 51 const VideoCaptureDeviceFormatsCB& callback) override; | |
| 52 void StartCapture(const media::VideoCaptureParams& params, | 48 void StartCapture(const media::VideoCaptureParams& params, |
| 53 const VideoCaptureDeliverFrameCB& frame_callback, | 49 const VideoCaptureDeliverFrameCB& frame_callback, |
| 54 const RunningCallback& running_callback) override; | 50 const RunningCallback& running_callback) override; |
| 55 void StopCapture() override; | 51 void StopCapture() override; |
| 56 private: | 52 private: |
| 57 const scoped_refptr<CastReceiverSession> cast_receiver_session_; | 53 const scoped_refptr<CastReceiverSession> cast_receiver_session_; |
| 58 }; | 54 }; |
| 59 | 55 |
| 60 CastReceiverSession::CastReceiverSession() | 56 CastReceiverSession::CastReceiverSession() |
| 61 : delegate_(new CastReceiverSessionDelegate()), | 57 : delegate_(new CastReceiverSessionDelegate()), |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 FROM_HERE, | 116 FROM_HERE, |
| 121 base::Bind(&CastReceiverSessionDelegate::StopVideo, | 117 base::Bind(&CastReceiverSessionDelegate::StopVideo, |
| 122 base::Unretained(delegate_.get()))); | 118 base::Unretained(delegate_.get()))); |
| 123 } | 119 } |
| 124 | 120 |
| 125 CastReceiverSession::VideoCapturerSource::VideoCapturerSource( | 121 CastReceiverSession::VideoCapturerSource::VideoCapturerSource( |
| 126 const scoped_refptr<CastReceiverSession> cast_receiver_session) | 122 const scoped_refptr<CastReceiverSession> cast_receiver_session) |
| 127 : cast_receiver_session_(cast_receiver_session) { | 123 : cast_receiver_session_(cast_receiver_session) { |
| 128 } | 124 } |
| 129 | 125 |
| 130 void CastReceiverSession::VideoCapturerSource::GetCurrentSupportedFormats( | 126 media::VideoCaptureFormats |
| 131 int max_requested_width, | 127 CastReceiverSession::VideoCapturerSource::GetPreferredFormats() { |
| 132 int max_requested_height, | 128 media::VideoCaptureFormats formats; |
| 133 double max_requested_frame_rate, | |
| 134 const VideoCaptureDeviceFormatsCB& callback) { | |
| 135 std::vector<media::VideoCaptureFormat> formats; | |
| 136 if (cast_receiver_session_->format_.IsValid()) | 129 if (cast_receiver_session_->format_.IsValid()) |
| 137 formats.push_back(cast_receiver_session_->format_); | 130 formats.push_back(cast_receiver_session_->format_); |
| 138 callback.Run(formats); | 131 return formats; |
| 139 } | 132 } |
| 140 | 133 |
| 141 void CastReceiverSession::VideoCapturerSource::StartCapture( | 134 void CastReceiverSession::VideoCapturerSource::StartCapture( |
| 142 const media::VideoCaptureParams& params, | 135 const media::VideoCaptureParams& params, |
| 143 const VideoCaptureDeliverFrameCB& frame_callback, | 136 const VideoCaptureDeliverFrameCB& frame_callback, |
| 144 const RunningCallback& running_callback) { | 137 const RunningCallback& running_callback) { |
| 145 cast_receiver_session_->StartVideo(frame_callback); | 138 cast_receiver_session_->StartVideo(frame_callback); |
| 146 running_callback.Run(true); | 139 running_callback.Run(true); |
| 147 } | 140 } |
| 148 | 141 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 177 } |
| 185 | 178 |
| 186 void CastReceiverSession::AudioCapturerSource::SetVolume(double volume) { | 179 void CastReceiverSession::AudioCapturerSource::SetVolume(double volume) { |
| 187 // not supported | 180 // not supported |
| 188 } | 181 } |
| 189 | 182 |
| 190 void CastReceiverSession::AudioCapturerSource::SetAutomaticGainControl( | 183 void CastReceiverSession::AudioCapturerSource::SetAutomaticGainControl( |
| 191 bool enable) { | 184 bool enable) { |
| 192 // not supported | 185 // not supported |
| 193 } | 186 } |
| OLD | NEW |