| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/renderer/media/cast_rtp_stream.h" | 5 #include "chrome/renderer/media/cast_rtp_stream.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 video_frame->format() == media::PIXEL_FORMAT_YV12A)) { | 227 video_frame->format() == media::PIXEL_FORMAT_YV12A)) { |
| 228 error_callback_.Run("Incompatible video frame format."); | 228 error_callback_.Run("Incompatible video frame format."); |
| 229 return; | 229 return; |
| 230 } | 230 } |
| 231 scoped_refptr<media::VideoFrame> frame = video_frame; | 231 scoped_refptr<media::VideoFrame> frame = video_frame; |
| 232 // Drop alpha channel since we do not support it yet. | 232 // Drop alpha channel since we do not support it yet. |
| 233 if (frame->format() == media::PIXEL_FORMAT_YV12A) | 233 if (frame->format() == media::PIXEL_FORMAT_YV12A) |
| 234 frame = media::WrapAsI420VideoFrame(video_frame); | 234 frame = media::WrapAsI420VideoFrame(video_frame); |
| 235 | 235 |
| 236 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc | 236 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc |
| 237 TRACE_EVENT_INSTANT2( | 237 TRACE_EVENT_INSTANT2("cast_perf_test", "ConsumeVideoFrame", |
| 238 "cast_perf_test", "MediaStreamVideoSink::OnVideoFrame", | 238 TRACE_EVENT_SCOPE_THREAD, "timestamp", |
| 239 TRACE_EVENT_SCOPE_THREAD, | 239 (timestamp - base::TimeTicks()).InMicroseconds(), |
| 240 "timestamp", timestamp.ToInternalValue(), | 240 "time_delta", frame->timestamp().InMicroseconds()); |
| 241 "time_delta", frame->timestamp().ToInternalValue()); | |
| 242 frame_input_->InsertRawVideoFrame(frame, timestamp); | 241 frame_input_->InsertRawVideoFrame(frame, timestamp); |
| 243 } | 242 } |
| 244 | 243 |
| 245 private: | 244 private: |
| 246 friend class base::RefCountedThreadSafe<Deliverer>; | 245 friend class base::RefCountedThreadSafe<Deliverer>; |
| 247 ~Deliverer() {} | 246 ~Deliverer() {} |
| 248 | 247 |
| 249 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 248 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 250 const CastRtpStream::ErrorCallback error_callback_; | 249 const CastRtpStream::ErrorCallback error_callback_; |
| 251 | 250 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 DCHECK(content::RenderThread::Get()); | 579 DCHECK(content::RenderThread::Get()); |
| 581 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message | 580 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message |
| 582 << ") = " << (is_audio_ ? "audio" : "video"); | 581 << ") = " << (is_audio_ ? "audio" : "video"); |
| 583 // Save the WeakPtr first because the error callback might delete this object. | 582 // Save the WeakPtr first because the error callback might delete this object. |
| 584 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); | 583 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); |
| 585 error_callback_.Run(message); | 584 error_callback_.Run(message); |
| 586 base::ThreadTaskRunnerHandle::Get()->PostTask( | 585 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 587 FROM_HERE, | 586 FROM_HERE, |
| 588 base::Bind(&CastRtpStream::Stop, ptr)); | 587 base::Bind(&CastRtpStream::Stop, ptr)); |
| 589 } | 588 } |
| OLD | NEW |