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

Side by Side Diff: media/filters/chunk_demuxer.cc

Issue 1904213003: Convert //media/filters from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove include Created 4 years, 8 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 | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/filters/chunk_demuxer.h" 5 #include "media/filters/chunk_demuxer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <list> 9 #include <list>
10 #include <utility> 10 #include <utility>
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 ChunkDemuxer::Status ChunkDemuxer::AddId(const std::string& id, 506 ChunkDemuxer::Status ChunkDemuxer::AddId(const std::string& id,
507 const std::string& type, 507 const std::string& type,
508 std::vector<std::string>& codecs) { 508 std::vector<std::string>& codecs) {
509 base::AutoLock auto_lock(lock_); 509 base::AutoLock auto_lock(lock_);
510 510
511 if ((state_ != WAITING_FOR_INIT && state_ != INITIALIZING) || IsValidId(id)) 511 if ((state_ != WAITING_FOR_INIT && state_ != INITIALIZING) || IsValidId(id))
512 return kReachedIdLimit; 512 return kReachedIdLimit;
513 513
514 bool has_audio = false; 514 bool has_audio = false;
515 bool has_video = false; 515 bool has_video = false;
516 scoped_ptr<media::StreamParser> stream_parser(StreamParserFactory::Create( 516 std::unique_ptr<media::StreamParser> stream_parser(
517 type, codecs, media_log_, &has_audio, &has_video)); 517 StreamParserFactory::Create(type, codecs, media_log_, &has_audio,
518 &has_video));
518 519
519 if (!stream_parser) 520 if (!stream_parser)
520 return ChunkDemuxer::kNotSupported; 521 return ChunkDemuxer::kNotSupported;
521 522
522 if ((has_audio && !source_id_audio_.empty()) || 523 if ((has_audio && !source_id_audio_.empty()) ||
523 (has_video && !source_id_video_.empty())) 524 (has_video && !source_id_video_.empty()))
524 return kReachedIdLimit; 525 return kReachedIdLimit;
525 526
526 if (has_audio) 527 if (has_audio)
527 source_id_audio_ = id; 528 source_id_audio_ = id;
528 529
529 if (has_video) 530 if (has_video)
530 source_id_video_ = id; 531 source_id_video_ = id;
531 532
532 scoped_ptr<FrameProcessor> frame_processor( 533 std::unique_ptr<FrameProcessor> frame_processor(
533 new FrameProcessor(base::Bind(&ChunkDemuxer::IncreaseDurationIfNecessary, 534 new FrameProcessor(base::Bind(&ChunkDemuxer::IncreaseDurationIfNecessary,
534 base::Unretained(this)), 535 base::Unretained(this)),
535 media_log_)); 536 media_log_));
536 537
537 scoped_ptr<MediaSourceState> source_state(new MediaSourceState( 538 std::unique_ptr<MediaSourceState> source_state(new MediaSourceState(
538 std::move(stream_parser), std::move(frame_processor), 539 std::move(stream_parser), std::move(frame_processor),
539 base::Bind(&ChunkDemuxer::CreateDemuxerStream, base::Unretained(this)), 540 base::Bind(&ChunkDemuxer::CreateDemuxerStream, base::Unretained(this)),
540 media_log_)); 541 media_log_));
541 542
542 MediaSourceState::NewTextTrackCB new_text_track_cb; 543 MediaSourceState::NewTextTrackCB new_text_track_cb;
543 544
544 if (enable_text_) { 545 if (enable_text_) {
545 new_text_track_cb = base::Bind(&ChunkDemuxer::OnNewTextTrack, 546 new_text_track_cb = base::Bind(&ChunkDemuxer::OnNewTextTrack,
546 base::Unretained(this)); 547 base::Unretained(this));
547 } 548 }
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 } 1140 }
1140 1141
1141 void ChunkDemuxer::ShutdownAllStreams() { 1142 void ChunkDemuxer::ShutdownAllStreams() {
1142 for (MediaSourceStateMap::iterator itr = source_state_map_.begin(); 1143 for (MediaSourceStateMap::iterator itr = source_state_map_.begin();
1143 itr != source_state_map_.end(); ++itr) { 1144 itr != source_state_map_.end(); ++itr) {
1144 itr->second->Shutdown(); 1145 itr->second->Shutdown();
1145 } 1146 }
1146 } 1147 }
1147 1148
1148 } // namespace media 1149 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698