| 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 "media/cast/receiver/cast_receiver_impl.h" | 5 #include "media/cast/receiver/cast_receiver_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 const VideoFrameDecodedCallback& callback, | 142 const VideoFrameDecodedCallback& callback, |
| 143 std::unique_ptr<EncodedFrame> encoded_frame) { | 143 std::unique_ptr<EncodedFrame> encoded_frame) { |
| 144 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 144 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 145 if (!encoded_frame) { | 145 if (!encoded_frame) { |
| 146 callback.Run( | 146 callback.Run( |
| 147 make_scoped_refptr<VideoFrame>(NULL), base::TimeTicks(), false); | 147 make_scoped_refptr<VideoFrame>(NULL), base::TimeTicks(), false); |
| 148 return; | 148 return; |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc | 151 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc |
| 152 TRACE_EVENT_INSTANT2( | 152 TRACE_EVENT_INSTANT1("cast_perf_test", "PullEncodedVideoFrame", |
| 153 "cast_perf_test", "PullEncodedVideoFrame", | 153 TRACE_EVENT_SCOPE_THREAD, "rtp_timestamp", |
| 154 TRACE_EVENT_SCOPE_THREAD, | 154 encoded_frame->rtp_timestamp.lower_32_bits()); |
| 155 "rtp_timestamp", encoded_frame->rtp_timestamp.lower_32_bits(), | |
| 156 "render_time", encoded_frame->reference_time.ToInternalValue()); | |
| 157 | 155 |
| 158 if (!video_decoder_) | 156 if (!video_decoder_) |
| 159 video_decoder_.reset(new VideoDecoder(cast_environment_, video_codec_)); | 157 video_decoder_.reset(new VideoDecoder(cast_environment_, video_codec_)); |
| 160 const FrameId frame_id = encoded_frame->frame_id; | 158 const FrameId frame_id = encoded_frame->frame_id; |
| 161 const RtpTimeTicks rtp_timestamp = encoded_frame->rtp_timestamp; | 159 const RtpTimeTicks rtp_timestamp = encoded_frame->rtp_timestamp; |
| 162 const base::TimeTicks playout_time = encoded_frame->reference_time; | 160 const base::TimeTicks playout_time = encoded_frame->reference_time; |
| 163 video_decoder_->DecodeFrame( | 161 video_decoder_->DecodeFrame( |
| 164 std::move(encoded_frame), | 162 std::move(encoded_frame), |
| 165 base::Bind(&CastReceiverImpl::EmitDecodedVideoFrame, cast_environment_, | 163 base::Bind(&CastReceiverImpl::EmitDecodedVideoFrame, cast_environment_, |
| 166 callback, frame_id, rtp_timestamp, playout_time)); | 164 callback, frame_id, rtp_timestamp, playout_time)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 std::unique_ptr<FrameEvent> playout_event(new FrameEvent()); | 208 std::unique_ptr<FrameEvent> playout_event(new FrameEvent()); |
| 211 playout_event->timestamp = cast_environment->Clock()->NowTicks(); | 209 playout_event->timestamp = cast_environment->Clock()->NowTicks(); |
| 212 playout_event->type = FRAME_PLAYOUT; | 210 playout_event->type = FRAME_PLAYOUT; |
| 213 playout_event->media_type = VIDEO_EVENT; | 211 playout_event->media_type = VIDEO_EVENT; |
| 214 playout_event->rtp_timestamp = rtp_timestamp; | 212 playout_event->rtp_timestamp = rtp_timestamp; |
| 215 playout_event->frame_id = frame_id; | 213 playout_event->frame_id = frame_id; |
| 216 playout_event->delay_delta = playout_time - playout_event->timestamp; | 214 playout_event->delay_delta = playout_time - playout_event->timestamp; |
| 217 cast_environment->logger()->DispatchFrameEvent(std::move(playout_event)); | 215 cast_environment->logger()->DispatchFrameEvent(std::move(playout_event)); |
| 218 | 216 |
| 219 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc | 217 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc |
| 220 TRACE_EVENT_INSTANT1( | 218 TRACE_EVENT_INSTANT2("cast_perf_test", "VideoFrameDecoded", |
| 221 "cast_perf_test", "FrameDecoded", | 219 TRACE_EVENT_SCOPE_THREAD, "rtp_timestamp", |
| 222 TRACE_EVENT_SCOPE_THREAD, | 220 rtp_timestamp.lower_32_bits(), "playout_time", |
| 223 "rtp_timestamp", rtp_timestamp.lower_32_bits()); | 221 (playout_time - base::TimeTicks()).InMicroseconds()); |
| 224 } | 222 } |
| 225 | 223 |
| 226 callback.Run(video_frame, playout_time, is_continuous); | 224 callback.Run(video_frame, playout_time, is_continuous); |
| 227 } | 225 } |
| 228 | 226 |
| 229 } // namespace cast | 227 } // namespace cast |
| 230 } // namespace media | 228 } // namespace media |
| OLD | NEW |