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

Side by Side Diff: media/muxers/webm_muxer.cc

Issue 2253943004: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/mojo/services/test_mojo_media_client.cc ('k') | media/muxers/webm_muxer_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 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 "media/muxers/webm_muxer.h" 5 #include "media/muxers/webm_muxer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "media/base/audio_parameters.h" 9 #include "media/base/audio_parameters.h"
10 #include "media/base/limits.h" 10 #include "media/base/limits.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (first_frame_timestamp_video_.is_null()) 137 if (first_frame_timestamp_video_.is_null())
138 first_frame_timestamp_video_ = timestamp; 138 first_frame_timestamp_video_ = timestamp;
139 } 139 }
140 140
141 // TODO(ajose): Support multiple tracks: http://crbug.com/528523 141 // TODO(ajose): Support multiple tracks: http://crbug.com/528523
142 if (has_audio_ && !audio_track_index_) { 142 if (has_audio_ && !audio_track_index_) {
143 DVLOG(1) << __func__ << ": delaying until audio track ready."; 143 DVLOG(1) << __func__ << ": delaying until audio track ready.";
144 if (is_key_frame) // Upon Key frame reception, empty the encoded queue. 144 if (is_key_frame) // Upon Key frame reception, empty the encoded queue.
145 encoded_frames_queue_.clear(); 145 encoded_frames_queue_.clear();
146 146
147 encoded_frames_queue_.push_back(base::WrapUnique(new EncodedVideoFrame( 147 encoded_frames_queue_.push_back(base::MakeUnique<EncodedVideoFrame>(
148 std::move(encoded_data), timestamp, is_key_frame))); 148 std::move(encoded_data), timestamp, is_key_frame));
149 return; 149 return;
150 } 150 }
151 151
152 // Dump all saved encoded video frames if any. 152 // Dump all saved encoded video frames if any.
153 while (!encoded_frames_queue_.empty()) { 153 while (!encoded_frames_queue_.empty()) {
154 AddFrame( 154 AddFrame(
155 std::move(encoded_frames_queue_.front()->data), video_track_index_, 155 std::move(encoded_frames_queue_.front()->data), video_track_index_,
156 encoded_frames_queue_.front()->timestamp - first_frame_timestamp_video_, 156 encoded_frames_queue_.front()->timestamp - first_frame_timestamp_video_,
157 encoded_frames_queue_.front()->is_keyframe); 157 encoded_frames_queue_.front()->is_keyframe);
158 encoded_frames_queue_.pop_front(); 158 encoded_frames_queue_.pop_front();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 WebmMuxer::EncodedVideoFrame::EncodedVideoFrame( 324 WebmMuxer::EncodedVideoFrame::EncodedVideoFrame(
325 std::unique_ptr<std::string> data, 325 std::unique_ptr<std::string> data,
326 base::TimeTicks timestamp, 326 base::TimeTicks timestamp,
327 bool is_keyframe) 327 bool is_keyframe)
328 : data(std::move(data)), timestamp(timestamp), is_keyframe(is_keyframe) {} 328 : data(std::move(data)), timestamp(timestamp), is_keyframe(is_keyframe) {}
329 329
330 WebmMuxer::EncodedVideoFrame::~EncodedVideoFrame() {} 330 WebmMuxer::EncodedVideoFrame::~EncodedVideoFrame() {}
331 331
332 } // namespace media 332 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/test_mojo_media_client.cc ('k') | media/muxers/webm_muxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698