| 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 (encoded_data->size() == 0u) { |
| 144 DLOG(WARNING) << __func__ << ": zero size encoded frame, skipping"; |
| 145 // Some encoders give sporadic zero-size data, see https://crbug.com/716451. |
| 146 return true; |
| 147 } |
| 148 |
| 143 if (!video_track_index_) { | 149 if (!video_track_index_) { |
| 144 // |track_index_|, cannot be zero (!), initialize WebmMuxer in that case. | 150 // |track_index_|, cannot be zero (!), initialize WebmMuxer in that case. |
| 145 // http://www.matroska.org/technical/specs/index.html#Tracks | 151 // http://www.matroska.org/technical/specs/index.html#Tracks |
| 146 AddVideoTrack(params.visible_rect_size, GetFrameRate(params)); | 152 AddVideoTrack(params.visible_rect_size, GetFrameRate(params)); |
| 147 if (first_frame_timestamp_video_.is_null()) | 153 if (first_frame_timestamp_video_.is_null()) |
| 148 first_frame_timestamp_video_ = timestamp; | 154 first_frame_timestamp_video_ = timestamp; |
| 149 } | 155 } |
| 150 | 156 |
| 151 // TODO(ajose): Support multiple tracks: http://crbug.com/528523 | 157 // TODO(ajose): Support multiple tracks: http://crbug.com/528523 |
| 152 if (has_audio_ && !audio_track_index_) { | 158 if (has_audio_ && !audio_track_index_) { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 base::TimeTicks timestamp, | 375 base::TimeTicks timestamp, |
| 370 bool is_keyframe) | 376 bool is_keyframe) |
| 371 : data(std::move(data)), | 377 : data(std::move(data)), |
| 372 alpha_data(std::move(alpha_data)), | 378 alpha_data(std::move(alpha_data)), |
| 373 timestamp(timestamp), | 379 timestamp(timestamp), |
| 374 is_keyframe(is_keyframe) {} | 380 is_keyframe(is_keyframe) {} |
| 375 | 381 |
| 376 WebmMuxer::EncodedVideoFrame::~EncodedVideoFrame() {} | 382 WebmMuxer::EncodedVideoFrame::~EncodedVideoFrame() {} |
| 377 | 383 |
| 378 } // namespace media | 384 } // namespace media |
| OLD | NEW |