| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/media/pepper_to_video_track_adapter.h" | 5 #include "content/renderer/media/pepper_to_video_track_adapter.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 public: | 39 public: |
| 40 PpFrameWriter(); | 40 PpFrameWriter(); |
| 41 ~PpFrameWriter() override; | 41 ~PpFrameWriter() override; |
| 42 | 42 |
| 43 // FrameWriterInterface implementation. | 43 // FrameWriterInterface implementation. |
| 44 // This method will be called by the Pepper host from render thread. | 44 // This method will be called by the Pepper host from render thread. |
| 45 void PutFrame(PPB_ImageData_Impl* image_data, int64_t time_stamp_ns) override; | 45 void PutFrame(PPB_ImageData_Impl* image_data, int64_t time_stamp_ns) override; |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 // MediaStreamVideoSource implementation. | 48 // MediaStreamVideoSource implementation. |
| 49 void GetCurrentSupportedFormats( | |
| 50 int max_requested_width, | |
| 51 int max_requested_height, | |
| 52 double max_requested_frame_rate, | |
| 53 const VideoCaptureDeviceFormatsCB& callback) override; | |
| 54 void StartSourceImpl( | 49 void StartSourceImpl( |
| 55 const media::VideoCaptureFormat& format, | 50 const media::VideoCaptureFormat& format, |
| 56 const blink::WebMediaConstraints& constraints, | 51 const blink::WebMediaConstraints& constraints, |
| 57 const VideoCaptureDeliverFrameCB& frame_callback) override; | 52 const VideoCaptureDeliverFrameCB& frame_callback) override; |
| 58 void StopSourceImpl() override; | 53 void StopSourceImpl() override; |
| 59 | 54 |
| 60 private: | 55 private: |
| 61 media::VideoFramePool frame_pool_; | 56 media::VideoFramePool frame_pool_; |
| 62 | 57 |
| 63 class FrameWriterDelegate; | 58 class FrameWriterDelegate; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 104 } |
| 110 | 105 |
| 111 PpFrameWriter::PpFrameWriter() { | 106 PpFrameWriter::PpFrameWriter() { |
| 112 DVLOG(3) << "PpFrameWriter ctor"; | 107 DVLOG(3) << "PpFrameWriter ctor"; |
| 113 } | 108 } |
| 114 | 109 |
| 115 PpFrameWriter::~PpFrameWriter() { | 110 PpFrameWriter::~PpFrameWriter() { |
| 116 DVLOG(3) << "PpFrameWriter dtor"; | 111 DVLOG(3) << "PpFrameWriter dtor"; |
| 117 } | 112 } |
| 118 | 113 |
| 119 void PpFrameWriter::GetCurrentSupportedFormats( | |
| 120 int max_requested_width, | |
| 121 int max_requested_height, | |
| 122 double max_requested_frame_rate, | |
| 123 const VideoCaptureDeviceFormatsCB& callback) { | |
| 124 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | |
| 125 DVLOG(3) << "PpFrameWriter::GetCurrentSupportedFormats()"; | |
| 126 // Since the input is free to change the resolution at any point in time | |
| 127 // the supported formats are unknown. | |
| 128 media::VideoCaptureFormats formats; | |
| 129 callback.Run(formats); | |
| 130 } | |
| 131 | |
| 132 void PpFrameWriter::StartSourceImpl( | 114 void PpFrameWriter::StartSourceImpl( |
| 133 const media::VideoCaptureFormat& format, | 115 const media::VideoCaptureFormat& format, |
| 134 const blink::WebMediaConstraints& constraints, | 116 const blink::WebMediaConstraints& constraints, |
| 135 const VideoCaptureDeliverFrameCB& frame_callback) { | 117 const VideoCaptureDeliverFrameCB& frame_callback) { |
| 136 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | 118 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 137 DCHECK(!delegate_.get()); | 119 DCHECK(!delegate_.get()); |
| 138 DVLOG(3) << "PpFrameWriter::StartSourceImpl()"; | 120 DVLOG(3) << "PpFrameWriter::StartSourceImpl()"; |
| 139 delegate_ = new FrameWriterDelegate(io_task_runner(), frame_callback); | 121 delegate_ = new FrameWriterDelegate(io_task_runner(), frame_callback); |
| 140 OnStartDone(MEDIA_DEVICE_OK); | 122 OnStartDone(MEDIA_DEVICE_OK); |
| 141 } | 123 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 246 |
| 265 bool track_enabled = true; | 247 bool track_enabled = true; |
| 266 stream.AddTrack(MediaStreamVideoTrack::CreateVideoTrack( | 248 stream.AddTrack(MediaStreamVideoTrack::CreateVideoTrack( |
| 267 writer, MediaStreamVideoSource::ConstraintsCallback(), track_enabled)); | 249 writer, MediaStreamVideoSource::ConstraintsCallback(), track_enabled)); |
| 268 | 250 |
| 269 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); | 251 *frame_writer = new PpFrameWriterProxy(writer->AsWeakPtr()); |
| 270 return true; | 252 return true; |
| 271 } | 253 } |
| 272 | 254 |
| 273 } // namespace content | 255 } // namespace content |
| OLD | NEW |