| 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_delegate.h" | 5 #include "chrome/renderer/media/cast_receiver_session_delegate.h" |
| 6 | 6 |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 | 9 |
| 10 CastReceiverSessionDelegate::CastReceiverSessionDelegate() | 10 CastReceiverSessionDelegate::CastReceiverSessionDelegate() |
| 11 : weak_factory_(this) { | 11 : weak_factory_(this) { |
| 12 } | 12 } |
| 13 CastReceiverSessionDelegate::~CastReceiverSessionDelegate() {} | 13 CastReceiverSessionDelegate::~CastReceiverSessionDelegate() {} |
| 14 | 14 |
| 15 void CastReceiverSessionDelegate::LogRawEvents( | 15 void CastReceiverSessionDelegate::LogRawEvents( |
| 16 const std::vector<media::cast::PacketEvent>& packet_events, | 16 const std::vector<media::cast::PacketEvent>& packet_events, |
| 17 const std::vector<media::cast::FrameEvent>& frame_events) { | 17 const std::vector<media::cast::FrameEvent>& frame_events) { |
| 18 NOTREACHED(); | 18 NOTREACHED(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 void CastReceiverSessionDelegate::Start( | 21 void CastReceiverSessionDelegate::Start( |
| 22 const media::cast::FrameReceiverConfig& audio_config, | 22 const media::cast::FrameReceiverConfig& audio_config, |
| 23 const media::cast::FrameReceiverConfig& video_config, | 23 const media::cast::FrameReceiverConfig& video_config, |
| 24 const net::IPEndPoint& local_endpoint, | 24 const net::IPEndPoint& local_endpoint, |
| 25 const net::IPEndPoint& remote_endpoint, | 25 const net::IPEndPoint& remote_endpoint, |
| 26 scoped_ptr<base::DictionaryValue> options, | 26 scoped_ptr<base::DictionaryValue> options, |
| 27 const media::VideoCaptureFormat& format) { | 27 const media::VideoCaptureFormat& format, |
| 28 const ErrorCallback& error_callback) { |
| 28 format_ = format; | 29 format_ = format; |
| 29 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); | 30 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); |
| 30 CastSessionDelegateBase::StartUDP(local_endpoint, | 31 CastSessionDelegateBase::StartUDP(local_endpoint, |
| 31 remote_endpoint, | 32 remote_endpoint, |
| 32 options.Pass()); | 33 options.Pass(), |
| 34 error_callback); |
| 33 cast_receiver_ = media::cast::CastReceiver::Create(cast_environment_, | 35 cast_receiver_ = media::cast::CastReceiver::Create(cast_environment_, |
| 34 audio_config, | 36 audio_config, |
| 35 video_config, | 37 video_config, |
| 36 cast_transport_.get()); | 38 cast_transport_.get()); |
| 37 on_audio_decoded_cb_ = base::Bind( | 39 on_audio_decoded_cb_ = base::Bind( |
| 38 &CastReceiverSessionDelegate::OnDecodedAudioFrame, | 40 &CastReceiverSessionDelegate::OnDecodedAudioFrame, |
| 39 weak_factory_.GetWeakPtr()); | 41 weak_factory_.GetWeakPtr()); |
| 40 on_video_decoded_cb_ = base::Bind( | 42 on_video_decoded_cb_ = base::Bind( |
| 41 &CastReceiverSessionDelegate::OnDecodedVideoFrame, | 43 &CastReceiverSessionDelegate::OnDecodedVideoFrame, |
| 42 weak_factory_.GetWeakPtr()); | 44 weak_factory_.GetWeakPtr()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 94 |
| 93 void CastReceiverSessionDelegate::OnDecodedVideoFrame( | 95 void CastReceiverSessionDelegate::OnDecodedVideoFrame( |
| 94 const scoped_refptr<media::VideoFrame>& video_frame, | 96 const scoped_refptr<media::VideoFrame>& video_frame, |
| 95 const base::TimeTicks& playout_time, | 97 const base::TimeTicks& playout_time, |
| 96 bool is_continous) { | 98 bool is_continous) { |
| 97 if (frame_callback_.is_null()) | 99 if (frame_callback_.is_null()) |
| 98 return; | 100 return; |
| 99 frame_callback_.Run(video_frame, format_, playout_time); | 101 frame_callback_.Run(video_frame, format_, playout_time); |
| 100 cast_receiver_->RequestDecodedVideoFrame(on_video_decoded_cb_); | 102 cast_receiver_->RequestDecodedVideoFrame(on_video_decoded_cb_); |
| 101 } | 103 } |
| OLD | NEW |