| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 payload.channels = 1; | 95 payload.channels = 1; |
| 96 payload.max_frame_rate = media::cast::kDefaultMaxFrameRate; | 96 payload.max_frame_rate = media::cast::kDefaultMaxFrameRate; |
| 97 payload.width = 1280; | 97 payload.width = 1280; |
| 98 payload.height = 720; | 98 payload.height = 720; |
| 99 payload.codec_name = kCodecNameH264; | 99 payload.codec_name = kCodecNameH264; |
| 100 return payload; | 100 return payload; |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool IsHardwareVP8EncodingSupported() { | 103 bool IsHardwareVP8EncodingSupported() { |
| 104 // Query for hardware VP8 encoder support. | 104 // Query for hardware VP8 encoder support. |
| 105 std::vector<media::VideoEncodeAccelerator::SupportedProfile> vea_profiles = | 105 std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> vea_profiles = |
| 106 content::GetSupportedVideoEncodeAcceleratorProfiles(); | 106 content::GetSupportedVideoEncodeAcceleratorProfiles(); |
| 107 for (size_t i = 0; i < vea_profiles.size(); ++i) { | 107 for (size_t i = 0; i < vea_profiles.size(); ++i) { |
| 108 if (vea_profiles[i].profile >= media::VP8PROFILE_MIN && | 108 if (vea_profiles[i].profile >= media::VP8PROFILE_MIN && |
| 109 vea_profiles[i].profile <= media::VP8PROFILE_MAX) { | 109 vea_profiles[i].profile <= media::VP8PROFILE_MAX) { |
| 110 return true; | 110 return true; |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 return false; | 113 return false; |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool IsHardwareH264EncodingSupported() { | 116 bool IsHardwareH264EncodingSupported() { |
| 117 // Query for hardware H.264 encoder support. | 117 // Query for hardware H.264 encoder support. |
| 118 std::vector<media::VideoEncodeAccelerator::SupportedProfile> vea_profiles = | 118 std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> vea_profiles = |
| 119 content::GetSupportedVideoEncodeAcceleratorProfiles(); | 119 content::GetSupportedVideoEncodeAcceleratorProfiles(); |
| 120 for (size_t i = 0; i < vea_profiles.size(); ++i) { | 120 for (size_t i = 0; i < vea_profiles.size(); ++i) { |
| 121 if (vea_profiles[i].profile >= media::H264PROFILE_MIN && | 121 if (vea_profiles[i].profile >= media::H264PROFILE_MIN && |
| 122 vea_profiles[i].profile <= media::H264PROFILE_MAX) { | 122 vea_profiles[i].profile <= media::H264PROFILE_MAX) { |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 | 128 |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 void CastRtpStream::DidEncounterError(const std::string& message) { | 596 void CastRtpStream::DidEncounterError(const std::string& message) { |
| 597 VLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " | 597 VLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " |
| 598 << (IsAudio() ? "audio" : "video"); | 598 << (IsAudio() ? "audio" : "video"); |
| 599 // Save the WeakPtr first because the error callback might delete this object. | 599 // Save the WeakPtr first because the error callback might delete this object. |
| 600 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); | 600 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); |
| 601 error_callback_.Run(message); | 601 error_callback_.Run(message); |
| 602 content::RenderThread::Get()->GetMessageLoop()->PostTask( | 602 content::RenderThread::Get()->GetMessageLoop()->PostTask( |
| 603 FROM_HERE, | 603 FROM_HERE, |
| 604 base::Bind(&CastRtpStream::Stop, ptr)); | 604 base::Bind(&CastRtpStream::Stop, ptr)); |
| 605 } | 605 } |
| OLD | NEW |