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 #include <algorithm> | 8 #include <algorithm> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // These parameters are already bound when callback is created. | 322 // These parameters are already bound when callback is created. |
323 const CastRtpStream::ErrorCallback& error_callback, | 323 const CastRtpStream::ErrorCallback& error_callback, |
324 const scoped_refptr<media::cast::VideoFrameInput> frame_input, | 324 const scoped_refptr<media::cast::VideoFrameInput> frame_input, |
325 // These parameters are passed for each frame. | 325 // These parameters are passed for each frame. |
326 const scoped_refptr<media::VideoFrame>& frame, | 326 const scoped_refptr<media::VideoFrame>& frame, |
327 base::TimeTicks estimated_capture_time) { | 327 base::TimeTicks estimated_capture_time) { |
328 const base::TimeTicks timestamp = estimated_capture_time.is_null() | 328 const base::TimeTicks timestamp = estimated_capture_time.is_null() |
329 ? base::TimeTicks::Now() | 329 ? base::TimeTicks::Now() |
330 : estimated_capture_time; | 330 : estimated_capture_time; |
331 | 331 |
| 332 if (!(frame->IsMappable() && |
| 333 (frame->format() == media::PIXEL_FORMAT_I420 || |
| 334 frame->format() == media::PIXEL_FORMAT_YV12 || |
| 335 frame->format() == media::PIXEL_FORMAT_YV12A))) { |
| 336 NOTREACHED(); |
| 337 return; |
| 338 } |
| 339 |
| 340 // Drop alpha channel since we do not support it yet. |
| 341 if (frame->format() == media::PIXEL_FORMAT_YV12A) |
| 342 frame->DropYV12AAlphaChannel(); |
| 343 |
332 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc | 344 // Used by chrome/browser/extension/api/cast_streaming/performance_test.cc |
333 TRACE_EVENT_INSTANT2( | 345 TRACE_EVENT_INSTANT2( |
334 "cast_perf_test", "MediaStreamVideoSink::OnVideoFrame", | 346 "cast_perf_test", "MediaStreamVideoSink::OnVideoFrame", |
335 TRACE_EVENT_SCOPE_THREAD, | 347 TRACE_EVENT_SCOPE_THREAD, |
336 "timestamp", timestamp.ToInternalValue(), | 348 "timestamp", timestamp.ToInternalValue(), |
337 "time_delta", frame->timestamp().ToInternalValue()); | 349 "time_delta", frame->timestamp().ToInternalValue()); |
338 frame_input->InsertRawVideoFrame(frame, timestamp); | 350 frame_input->InsertRawVideoFrame(frame, timestamp); |
339 } | 351 } |
340 | 352 |
341 // Attach this sink to a video track represented by |track_|. | 353 // Attach this sink to a video track represented by |track_|. |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 DCHECK(content::RenderThread::Get()); | 639 DCHECK(content::RenderThread::Get()); |
628 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " | 640 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " |
629 << (IsAudio() ? "audio" : "video"); | 641 << (IsAudio() ? "audio" : "video"); |
630 // Save the WeakPtr first because the error callback might delete this object. | 642 // Save the WeakPtr first because the error callback might delete this object. |
631 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); | 643 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); |
632 error_callback_.Run(message); | 644 error_callback_.Run(message); |
633 base::ThreadTaskRunnerHandle::Get()->PostTask( | 645 base::ThreadTaskRunnerHandle::Get()->PostTask( |
634 FROM_HERE, | 646 FROM_HERE, |
635 base::Bind(&CastRtpStream::Stop, ptr)); | 647 base::Bind(&CastRtpStream::Stop, ptr)); |
636 } | 648 } |
OLD | NEW |