Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: chrome/renderer/media/cast_rtp_stream.cc

Issue 1818203002: Fix Cast Streaming regression caused by enabling H264 HW encoder on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/cast_streaming/end_to_end_sender.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 116
117 bool IsHardwareH264EncodingSupported() { 117 bool IsHardwareH264EncodingSupported() {
118 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 118 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
119 if (cmd_line->HasSwitch(switches::kDisableCastStreamingHWEncoding)) { 119 if (cmd_line->HasSwitch(switches::kDisableCastStreamingHWEncoding)) {
120 DVLOG(1) << "Disabled hardware h264 support for Cast Streaming."; 120 DVLOG(1) << "Disabled hardware h264 support for Cast Streaming.";
121 return false; 121 return false;
122 } 122 }
123 123
124 // Query for hardware H.264 encoder support. 124 // Query for hardware H.264 encoder support.
125 //
126 // TODO(miu): Look into why H.264 hardware encoder on MacOS is broken.
127 // http://crbug.com/596674
128 #if !defined(OS_MACOSX)
125 const std::vector<media::VideoEncodeAccelerator::SupportedProfile> 129 const std::vector<media::VideoEncodeAccelerator::SupportedProfile>
126 vea_profiles = content::GetSupportedVideoEncodeAcceleratorProfiles(); 130 vea_profiles = content::GetSupportedVideoEncodeAcceleratorProfiles();
127 for (const auto& vea_profile : vea_profiles) { 131 for (const auto& vea_profile : vea_profiles) {
128 if (vea_profile.profile >= media::H264PROFILE_MIN && 132 if (vea_profile.profile >= media::H264PROFILE_MIN &&
129 vea_profile.profile <= media::H264PROFILE_MAX) { 133 vea_profile.profile <= media::H264PROFILE_MAX) {
130 return true; 134 return true;
131 } 135 }
132 } 136 }
137 #endif // !defined(OS_MACOSX)
133 return false; 138 return false;
134 } 139 }
135 140
136 int NumberOfEncodeThreads() { 141 int NumberOfEncodeThreads() {
137 // Do not saturate CPU utilization just for encoding. On a lower-end system 142 // Do not saturate CPU utilization just for encoding. On a lower-end system
138 // with only 1 or 2 cores, use only one thread for encoding. On systems with 143 // with only 1 or 2 cores, use only one thread for encoding. On systems with
139 // more cores, allow half of the cores to be used for encoding. 144 // more cores, allow half of the cores to be used for encoding.
140 return std::min(8, (base::SysInfo::NumberOfProcessors() + 1) / 2); 145 return std::min(8, (base::SysInfo::NumberOfProcessors() + 1) / 2);
141 } 146 }
142 147
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 DCHECK(content::RenderThread::Get()); 648 DCHECK(content::RenderThread::Get());
644 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " 649 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = "
645 << (IsAudio() ? "audio" : "video"); 650 << (IsAudio() ? "audio" : "video");
646 // Save the WeakPtr first because the error callback might delete this object. 651 // Save the WeakPtr first because the error callback might delete this object.
647 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); 652 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr();
648 error_callback_.Run(message); 653 error_callback_.Run(message);
649 base::ThreadTaskRunnerHandle::Get()->PostTask( 654 base::ThreadTaskRunnerHandle::Get()->PostTask(
650 FROM_HERE, 655 FROM_HERE,
651 base::Bind(&CastRtpStream::Stop, ptr)); 656 base::Bind(&CastRtpStream::Stop, ptr));
652 } 657 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/cast_streaming/end_to_end_sender.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698