| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/pepper/pepper_media_stream_video_track_host.h" | 5 #include "content/renderer/pepper/pepper_media_stream_video_track_host.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 io_message_loop_->PostTask( | 218 io_message_loop_->PostTask( |
| 219 FROM_HERE, | 219 FROM_HERE, |
| 220 base::Bind(&FrameDeliverer::DeliverFrameOnIO, | 220 base::Bind(&FrameDeliverer::DeliverFrameOnIO, |
| 221 this, frame, format)); | 221 this, frame, format)); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void PepperMediaStreamVideoTrackHost::FrameDeliverer::DeliverFrameOnIO( | 224 void PepperMediaStreamVideoTrackHost::FrameDeliverer::DeliverFrameOnIO( |
| 225 const scoped_refptr<media::VideoFrame>& frame, | 225 const scoped_refptr<media::VideoFrame>& frame, |
| 226 const media::VideoCaptureFormat& format) { | 226 const media::VideoCaptureFormat& format) { |
| 227 DCHECK(io_message_loop_->BelongsToCurrentThread()); | 227 DCHECK(io_message_loop_->BelongsToCurrentThread()); |
| 228 new_frame_callback_.Run(frame, format); | 228 // The time when this frame is generated is unknown so give a null value to |
| 229 // |estimated_capture_time|. |
| 230 new_frame_callback_.Run(frame, format, base::TimeTicks()); |
| 229 } | 231 } |
| 230 | 232 |
| 231 PepperMediaStreamVideoTrackHost::PepperMediaStreamVideoTrackHost( | 233 PepperMediaStreamVideoTrackHost::PepperMediaStreamVideoTrackHost( |
| 232 RendererPpapiHost* host, | 234 RendererPpapiHost* host, |
| 233 PP_Instance instance, | 235 PP_Instance instance, |
| 234 PP_Resource resource, | 236 PP_Resource resource, |
| 235 const blink::WebMediaStreamTrack& track) | 237 const blink::WebMediaStreamTrack& track) |
| 236 : PepperMediaStreamTrackHostBase(host, instance, resource), | 238 : PepperMediaStreamTrackHostBase(host, instance, resource), |
| 237 track_(track), | 239 track_(track), |
| 238 connected_(false), | 240 connected_(false), |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 ToPixelFormat(plugin_frame_format_))); | 376 ToPixelFormat(plugin_frame_format_))); |
| 375 } | 377 } |
| 376 | 378 |
| 377 // Makes the frame available again for plugin. | 379 // Makes the frame available again for plugin. |
| 378 SendEnqueueBufferMessageToPlugin(index); | 380 SendEnqueueBufferMessageToPlugin(index); |
| 379 return PP_OK; | 381 return PP_OK; |
| 380 } | 382 } |
| 381 | 383 |
| 382 void PepperMediaStreamVideoTrackHost::OnVideoFrame( | 384 void PepperMediaStreamVideoTrackHost::OnVideoFrame( |
| 383 const scoped_refptr<VideoFrame>& frame, | 385 const scoped_refptr<VideoFrame>& frame, |
| 384 const media::VideoCaptureFormat& format) { | 386 const media::VideoCaptureFormat& format, |
| 387 const base::TimeTicks& estimated_capture_time) { |
| 385 DCHECK(frame); | 388 DCHECK(frame); |
| 386 // TODO(penghuang): Check |frame->end_of_stream()| and close the track. | 389 // TODO(penghuang): Check |frame->end_of_stream()| and close the track. |
| 387 PP_VideoFrame_Format ppformat = ToPpapiFormat(frame->format()); | 390 PP_VideoFrame_Format ppformat = ToPpapiFormat(frame->format()); |
| 388 if (ppformat == PP_VIDEOFRAME_FORMAT_UNKNOWN) | 391 if (ppformat == PP_VIDEOFRAME_FORMAT_UNKNOWN) |
| 389 return; | 392 return; |
| 390 | 393 |
| 391 if (source_frame_size_.IsEmpty()) { | 394 if (source_frame_size_.IsEmpty()) { |
| 392 source_frame_size_ = frame->coded_size(); | 395 source_frame_size_ = frame->coded_size(); |
| 393 source_frame_format_ = ppformat; | 396 source_frame_format_ = ppformat; |
| 394 InitBuffers(); | 397 InitBuffers(); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 base::Unretained(this)), | 536 base::Unretained(this)), |
| 534 enabled); | 537 enabled); |
| 535 } | 538 } |
| 536 | 539 |
| 537 void PepperMediaStreamVideoTrackHost::OnTrackStarted( | 540 void PepperMediaStreamVideoTrackHost::OnTrackStarted( |
| 538 MediaStreamSource* source, bool success) { | 541 MediaStreamSource* source, bool success) { |
| 539 DVLOG(3) << "OnTrackStarted result: " << success; | 542 DVLOG(3) << "OnTrackStarted result: " << success; |
| 540 } | 543 } |
| 541 | 544 |
| 542 } // namespace content | 545 } // namespace content |
| OLD | NEW |