| OLD | NEW |
| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 133 } |
| 134 | 134 |
| 135 bool WebmMuxer::OnEncodedVideo(const VideoParameters& params, | 135 bool WebmMuxer::OnEncodedVideo(const VideoParameters& params, |
| 136 std::unique_ptr<std::string> encoded_data, | 136 std::unique_ptr<std::string> encoded_data, |
| 137 std::unique_ptr<std::string> encoded_alpha, | 137 std::unique_ptr<std::string> encoded_alpha, |
| 138 base::TimeTicks timestamp, | 138 base::TimeTicks timestamp, |
| 139 bool is_key_frame) { | 139 bool is_key_frame) { |
| 140 DVLOG(1) << __func__ << " - " << encoded_data->size() << "B"; | 140 DVLOG(1) << __func__ << " - " << encoded_data->size() << "B"; |
| 141 DCHECK(thread_checker_.CalledOnValidThread()); | 141 DCHECK(thread_checker_.CalledOnValidThread()); |
| 142 | 142 |
| 143 if (!last_frame_size_.IsEmpty() && |
| 144 last_frame_size_ != params.visible_rect_size) { |
| 145 mkvmuxer::VideoTrack* const video_track = |
| 146 reinterpret_cast<mkvmuxer::VideoTrack*>( |
| 147 segment_.GetTrackByNumber(video_track_index_)); |
| 148 DCHECK(video_track); |
| 149 video_track->set_width(params.visible_rect_size.width()); |
| 150 video_track->set_height(params.visible_rect_size.height()); |
| 151 } |
| 152 last_frame_size_ = params.visible_rect_size; |
| 153 |
| 143 if (!video_track_index_) { | 154 if (!video_track_index_) { |
| 144 // |track_index_|, cannot be zero (!), initialize WebmMuxer in that case. | 155 // |track_index_|, cannot be zero (!), initialize WebmMuxer in that case. |
| 145 // http://www.matroska.org/technical/specs/index.html#Tracks | 156 // http://www.matroska.org/technical/specs/index.html#Tracks |
| 146 AddVideoTrack(params.visible_rect_size, GetFrameRate(params)); | 157 AddVideoTrack(params.visible_rect_size, GetFrameRate(params)); |
| 147 if (first_frame_timestamp_video_.is_null()) | 158 if (first_frame_timestamp_video_.is_null()) |
| 148 first_frame_timestamp_video_ = timestamp; | 159 first_frame_timestamp_video_ = timestamp; |
| 149 } | 160 } |
| 150 | 161 |
| 151 // TODO(ajose): Support multiple tracks: http://crbug.com/528523 | 162 // TODO(ajose): Support multiple tracks: http://crbug.com/528523 |
| 152 if (has_audio_ && !audio_track_index_) { | 163 if (has_audio_ && !audio_track_index_) { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 base::TimeTicks timestamp, | 377 base::TimeTicks timestamp, |
| 367 bool is_keyframe) | 378 bool is_keyframe) |
| 368 : data(std::move(data)), | 379 : data(std::move(data)), |
| 369 alpha_data(std::move(alpha_data)), | 380 alpha_data(std::move(alpha_data)), |
| 370 timestamp(timestamp), | 381 timestamp(timestamp), |
| 371 is_keyframe(is_keyframe) {} | 382 is_keyframe(is_keyframe) {} |
| 372 | 383 |
| 373 WebmMuxer::EncodedVideoFrame::~EncodedVideoFrame() {} | 384 WebmMuxer::EncodedVideoFrame::~EncodedVideoFrame() {} |
| 374 | 385 |
| 375 } // namespace media | 386 } // namespace media |
| OLD | NEW |