| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 425 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 426 if (cmd_line->HasSwitch(switches::kDisableCastStreamingHWEncoding)) { | 426 if (cmd_line->HasSwitch(switches::kDisableCastStreamingHWEncoding)) { |
| 427 DVLOG(1) << "Disabled hardware h264 support for Cast Streaming."; | 427 DVLOG(1) << "Disabled hardware h264 support for Cast Streaming."; |
| 428 return false; | 428 return false; |
| 429 } | 429 } |
| 430 | 430 |
| 431 // Query for hardware H.264 encoder support. | 431 // Query for hardware H.264 encoder support. |
| 432 // | 432 // |
| 433 // TODO(miu): Look into why H.264 hardware encoder on MacOS is broken. | 433 // TODO(miu): Look into why H.264 hardware encoder on MacOS is broken. |
| 434 // http://crbug.com/596674 | 434 // http://crbug.com/596674 |
| 435 #if !defined(OS_MACOSX) | 435 // TODO(emircan): Look into HW encoder initialization issues on Win. |
| 436 // https://crbug.com/636064 |
| 437 #if !defined(OS_MACOSX) && !defined(OS_WIN) |
| 436 const std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 438 const std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
| 437 vea_profiles = content::GetSupportedVideoEncodeAcceleratorProfiles(); | 439 vea_profiles = content::GetSupportedVideoEncodeAcceleratorProfiles(); |
| 438 for (const auto& vea_profile : vea_profiles) { | 440 for (const auto& vea_profile : vea_profiles) { |
| 439 if (vea_profile.profile >= media::H264PROFILE_MIN && | 441 if (vea_profile.profile >= media::H264PROFILE_MIN && |
| 440 vea_profile.profile <= media::H264PROFILE_MAX) { | 442 vea_profile.profile <= media::H264PROFILE_MAX) { |
| 441 return true; | 443 return true; |
| 442 } | 444 } |
| 443 } | 445 } |
| 444 #endif // !defined(OS_MACOSX) | 446 #endif // !defined(OS_MACOSX) && !defined(OS_WIN) |
| 445 return false; | 447 return false; |
| 446 } | 448 } |
| 447 | 449 |
| 448 CastRtpStream::CastRtpStream(const blink::WebMediaStreamTrack& track, | 450 CastRtpStream::CastRtpStream(const blink::WebMediaStreamTrack& track, |
| 449 const scoped_refptr<CastSession>& session) | 451 const scoped_refptr<CastSession>& session) |
| 450 : track_(track), cast_session_(session), weak_factory_(this) {} | 452 : track_(track), cast_session_(session), weak_factory_(this) {} |
| 451 | 453 |
| 452 CastRtpStream::~CastRtpStream() { | 454 CastRtpStream::~CastRtpStream() { |
| 453 Stop(); | 455 Stop(); |
| 454 } | 456 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 DCHECK(content::RenderThread::Get()); | 541 DCHECK(content::RenderThread::Get()); |
| 540 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " | 542 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " |
| 541 << (IsAudio() ? "audio" : "video"); | 543 << (IsAudio() ? "audio" : "video"); |
| 542 // Save the WeakPtr first because the error callback might delete this object. | 544 // Save the WeakPtr first because the error callback might delete this object. |
| 543 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); | 545 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); |
| 544 error_callback_.Run(message); | 546 error_callback_.Run(message); |
| 545 base::ThreadTaskRunnerHandle::Get()->PostTask( | 547 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 546 FROM_HERE, | 548 FROM_HERE, |
| 547 base::Bind(&CastRtpStream::Stop, ptr)); | 549 base::Bind(&CastRtpStream::Stop, ptr)); |
| 548 } | 550 } |
| OLD | NEW |