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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 params.payload.min_bitrate * kBitrateMultiplier; | 201 params.payload.min_bitrate * kBitrateMultiplier; |
202 config->max_bitrate = params.payload.max_bitrate * kBitrateMultiplier; | 202 config->max_bitrate = params.payload.max_bitrate * kBitrateMultiplier; |
203 if (config->min_bitrate > config->max_bitrate) | 203 if (config->min_bitrate > config->max_bitrate) |
204 return false; | 204 return false; |
205 config->start_bitrate = config->min_bitrate; | 205 config->start_bitrate = config->min_bitrate; |
206 config->max_frame_rate = static_cast<int>( | 206 config->max_frame_rate = static_cast<int>( |
207 std::max(1.0, params.payload.max_frame_rate) + 0.5); | 207 std::max(1.0, params.payload.max_frame_rate) + 0.5); |
208 if (config->max_frame_rate > 120) | 208 if (config->max_frame_rate > 120) |
209 return false; | 209 return false; |
210 if (params.payload.codec_name == kCodecNameVp8) { | 210 if (params.payload.codec_name == kCodecNameVp8) { |
211 config->max_number_of_video_buffers_used = 3; | |
Alpha Left Google
2014/08/25 23:23:44
Two issues:
1. We do not want to turn on this mod
hubbe
2014/08/27 04:14:03
1. Done
2. Agreed, but perhaps in a separate CL.
| |
211 config->use_external_encoder = IsHardwareVP8EncodingSupported(); | 212 config->use_external_encoder = IsHardwareVP8EncodingSupported(); |
212 config->codec = media::cast::CODEC_VIDEO_VP8; | 213 config->codec = media::cast::CODEC_VIDEO_VP8; |
213 } else if (params.payload.codec_name == kCodecNameH264) { | 214 } else if (params.payload.codec_name == kCodecNameH264) { |
214 config->use_external_encoder = IsHardwareH264EncodingSupported(); | 215 config->use_external_encoder = IsHardwareH264EncodingSupported(); |
215 config->codec = media::cast::CODEC_VIDEO_H264; | 216 config->codec = media::cast::CODEC_VIDEO_H264; |
216 } else { | 217 } else { |
217 return false; | 218 return false; |
218 } | 219 } |
219 if (!config->use_external_encoder) { | 220 if (!config->use_external_encoder) { |
220 config->number_of_encode_threads = NumberOfEncodeThreads(); | 221 config->number_of_encode_threads = NumberOfEncodeThreads(); |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
581 void CastRtpStream::DidEncounterError(const std::string& message) { | 582 void CastRtpStream::DidEncounterError(const std::string& message) { |
582 VLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " | 583 VLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " |
583 << (IsAudio() ? "audio" : "video"); | 584 << (IsAudio() ? "audio" : "video"); |
584 // Save the WeakPtr first because the error callback might delete this object. | 585 // Save the WeakPtr first because the error callback might delete this object. |
585 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); | 586 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); |
586 error_callback_.Run(message); | 587 error_callback_.Run(message); |
587 content::RenderThread::Get()->GetMessageLoop()->PostTask( | 588 content::RenderThread::Get()->GetMessageLoop()->PostTask( |
588 FROM_HERE, | 589 FROM_HERE, |
589 base::Bind(&CastRtpStream::Stop, ptr)); | 590 base::Bind(&CastRtpStream::Stop, ptr)); |
590 } | 591 } |
OLD | NEW |