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

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

Issue 2815303005: Avoid setting alpha mode for H264 webm containers (Closed)
Patch Set: Created 3 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 | « no previous file | no next file » | 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 reinterpret_cast<mkvmuxer::VideoTrack*>( 239 reinterpret_cast<mkvmuxer::VideoTrack*>(
240 segment_.GetTrackByNumber(video_track_index_)); 240 segment_.GetTrackByNumber(video_track_index_));
241 DCHECK(video_track); 241 DCHECK(video_track);
242 video_track->set_codec_id(MkvCodeIcForMediaVideoCodecId(video_codec_)); 242 video_track->set_codec_id(MkvCodeIcForMediaVideoCodecId(video_codec_));
243 DCHECK_EQ(0ull, video_track->crop_right()); 243 DCHECK_EQ(0ull, video_track->crop_right());
244 DCHECK_EQ(0ull, video_track->crop_left()); 244 DCHECK_EQ(0ull, video_track->crop_left());
245 DCHECK_EQ(0ull, video_track->crop_top()); 245 DCHECK_EQ(0ull, video_track->crop_top());
246 DCHECK_EQ(0ull, video_track->crop_bottom()); 246 DCHECK_EQ(0ull, video_track->crop_bottom());
247 DCHECK_EQ(0.0f, video_track->frame_rate()); 247 DCHECK_EQ(0.0f, video_track->frame_rate());
248 248
249 // Segment's timestamps should be in milliseconds, DCHECK it. See
250 // http://www.webmproject.org/docs/container/#muxer-guidelines
251 DCHECK_EQ(1000000ull, segment_.GetSegmentInfo()->timecode_scale());
252
253 // Set alpha channel parameters for only VPX, see crbug.com/711825.
mcasas 2017/04/14 23:34:51 nit: "only for VPx (https://crbug.com/711825)."
254 if (video_codec_ == kCodecH264)
255 return;
249 video_track->SetAlphaMode(mkvmuxer::VideoTrack::kAlpha); 256 video_track->SetAlphaMode(mkvmuxer::VideoTrack::kAlpha);
250 // Alpha channel, if present, is stored in a BlockAdditional next to the 257 // Alpha channel, if present, is stored in a BlockAdditional next to the
251 // associated opaque Block, see 258 // associated opaque Block, see
252 // https://matroska.org/technical/specs/index.html#BlockAdditional. 259 // https://matroska.org/technical/specs/index.html#BlockAdditional.
253 // This follows Method 1 for VP8 encoding of A-channel described on 260 // This follows Method 1 for VP8 encoding of A-channel described on
254 // http://wiki.webmproject.org/alpha-channel. 261 // http://wiki.webmproject.org/alpha-channel.
255 video_track->set_max_block_additional_id(1); 262 video_track->set_max_block_additional_id(1);
256
257 // Segment's timestamps should be in milliseconds, DCHECK it. See
258 // http://www.webmproject.org/docs/container/#muxer-guidelines
259 DCHECK_EQ(1000000ull, segment_.GetSegmentInfo()->timecode_scale());
260 } 263 }
261 264
262 void WebmMuxer::AddAudioTrack(const media::AudioParameters& params) { 265 void WebmMuxer::AddAudioTrack(const media::AudioParameters& params) {
263 DVLOG(1) << __func__ << " " << params.AsHumanReadableString(); 266 DVLOG(1) << __func__ << " " << params.AsHumanReadableString();
264 DCHECK(thread_checker_.CalledOnValidThread()); 267 DCHECK(thread_checker_.CalledOnValidThread());
265 DCHECK_EQ(0u, audio_track_index_) 268 DCHECK_EQ(0u, audio_track_index_)
266 << "WebmMuxer audio can only be initialised once."; 269 << "WebmMuxer audio can only be initialised once.";
267 270
268 audio_track_index_ = 271 audio_track_index_ =
269 segment_.AddAudioTrack(params.sample_rate(), params.channels(), 0); 272 segment_.AddAudioTrack(params.sample_rate(), params.channels(), 0);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 base::TimeTicks timestamp, 369 base::TimeTicks timestamp,
367 bool is_keyframe) 370 bool is_keyframe)
368 : data(std::move(data)), 371 : data(std::move(data)),
369 alpha_data(std::move(alpha_data)), 372 alpha_data(std::move(alpha_data)),
370 timestamp(timestamp), 373 timestamp(timestamp),
371 is_keyframe(is_keyframe) {} 374 is_keyframe(is_keyframe) {}
372 375
373 WebmMuxer::EncodedVideoFrame::~EncodedVideoFrame() {} 376 WebmMuxer::EncodedVideoFrame::~EncodedVideoFrame() {}
374 377
375 } // namespace media 378 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698