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

Side by Side Diff: content/renderer/media/media_recorder_handler.cc

Issue 2101943004: content: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase/update Created 4 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/renderer/media/media_recorder_handler.h" 5 #include "content/renderer/media/media_recorder_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // http://www.webmproject.org/docs/container Sec:"HTML5 Video Type Parameters" 85 // http://www.webmproject.org/docs/container Sec:"HTML5 Video Type Parameters"
86 static const char* const kVideoCodecs[] = { "vp8", "vp9", "h264", "opus" }; 86 static const char* const kVideoCodecs[] = { "vp8", "vp9", "h264", "opus" };
87 static const char* const kAudioCodecs[] = { "opus" }; 87 static const char* const kAudioCodecs[] = { "opus" };
88 const char* const* codecs = video ? &kVideoCodecs[0] : &kAudioCodecs[0]; 88 const char* const* codecs = video ? &kVideoCodecs[0] : &kAudioCodecs[0];
89 const int codecs_count = 89 const int codecs_count =
90 video ? arraysize(kVideoCodecs) : arraysize(kAudioCodecs); 90 video ? arraysize(kVideoCodecs) : arraysize(kAudioCodecs);
91 91
92 std::vector<std::string> codecs_list; 92 std::vector<std::string> codecs_list;
93 media::ParseCodecString(web_codecs.utf8(), &codecs_list, true /* strip */); 93 media::ParseCodecString(web_codecs.utf8(), &codecs_list, true /* strip */);
94 for (const auto& codec : codecs_list) { 94 for (const auto& codec : codecs_list) {
95 const auto found = std::find_if( 95 auto* const* found = std::find_if(
96 &codecs[0], &codecs[codecs_count], [&codec](const char* name) { 96 &codecs[0], &codecs[codecs_count], [&codec](const char* name) {
97 return base::EqualsCaseInsensitiveASCII(codec, name); 97 return base::EqualsCaseInsensitiveASCII(codec, name);
98 }); 98 });
99 if (found == &codecs[codecs_count]) 99 if (found == &codecs[codecs_count])
100 return false; 100 return false;
101 } 101 }
102 return true; 102 return true;
103 } 103 }
104 104
105 bool MediaRecorderHandler::initialize( 105 bool MediaRecorderHandler::initialize(
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 timeslice_ = TimeDelta::FromMilliseconds(0); 233 timeslice_ = TimeDelta::FromMilliseconds(0);
234 video_recorders_.clear(); 234 video_recorders_.clear();
235 audio_recorders_.clear(); 235 audio_recorders_.clear();
236 webm_muxer_.reset(); 236 webm_muxer_.reset();
237 } 237 }
238 238
239 void MediaRecorderHandler::pause() { 239 void MediaRecorderHandler::pause() {
240 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 240 DCHECK(main_render_thread_checker_.CalledOnValidThread());
241 DCHECK(recording_); 241 DCHECK(recording_);
242 recording_ = false; 242 recording_ = false;
243 for (const auto& video_recorder : video_recorders_) 243 for (auto* video_recorder : video_recorders_)
244 video_recorder->Pause(); 244 video_recorder->Pause();
245 for (const auto& audio_recorder : audio_recorders_) 245 for (auto* audio_recorder : audio_recorders_)
246 audio_recorder->Pause(); 246 audio_recorder->Pause();
247 webm_muxer_->Pause(); 247 webm_muxer_->Pause();
248 } 248 }
249 249
250 void MediaRecorderHandler::resume() { 250 void MediaRecorderHandler::resume() {
251 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 251 DCHECK(main_render_thread_checker_.CalledOnValidThread());
252 DCHECK(!recording_); 252 DCHECK(!recording_);
253 recording_ = true; 253 recording_ = true;
254 for (const auto& video_recorder : video_recorders_) 254 for (auto* video_recorder : video_recorders_)
255 video_recorder->Resume(); 255 video_recorder->Resume();
256 for (const auto& audio_recorder : audio_recorders_) 256 for (auto* audio_recorder : audio_recorders_)
257 audio_recorder->Resume(); 257 audio_recorder->Resume();
258 webm_muxer_->Resume(); 258 webm_muxer_->Resume();
259 } 259 }
260 260
261 void MediaRecorderHandler::OnEncodedVideo( 261 void MediaRecorderHandler::OnEncodedVideo(
262 const scoped_refptr<media::VideoFrame>& video_frame, 262 const scoped_refptr<media::VideoFrame>& video_frame,
263 std::unique_ptr<std::string> encoded_data, 263 std::unique_ptr<std::string> encoded_data,
264 TimeTicks timestamp, 264 TimeTicks timestamp,
265 bool is_key_frame) { 265 bool is_key_frame) {
266 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 266 DCHECK(main_render_thread_checker_.CalledOnValidThread());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 recorder->OnData(audio_bus, timestamp); 309 recorder->OnData(audio_bus, timestamp);
310 } 310 }
311 311
312 void MediaRecorderHandler::SetAudioFormatForTesting( 312 void MediaRecorderHandler::SetAudioFormatForTesting(
313 const media::AudioParameters& params) { 313 const media::AudioParameters& params) {
314 for (auto* recorder : audio_recorders_) 314 for (auto* recorder : audio_recorders_)
315 recorder->OnSetFormat(params); 315 recorder->OnSetFormat(params);
316 } 316 }
317 317
318 } // namespace content 318 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin.cc ('k') | content/renderer/media/media_stream_video_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698