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

Side by Side Diff: webrtc/modules/video_coding/utility/ivf_file_writer.cc

Issue 2509273002: Unify VideoCodecType to/from string functionality (Closed)
Patch Set: Rebase and update unknown string in WebRtcVideoEncoderFactory Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 height_ = encoded_image._encodedHeight; 115 height_ = encoded_image._encodedHeight;
116 RTC_CHECK_GT(width_, 0); 116 RTC_CHECK_GT(width_, 0);
117 RTC_CHECK_GT(height_, 0); 117 RTC_CHECK_GT(height_, 0);
118 using_capture_timestamps_ = encoded_image._timeStamp == 0; 118 using_capture_timestamps_ = encoded_image._timeStamp == 0;
119 119
120 codec_type_ = codec_type; 120 codec_type_ = codec_type;
121 121
122 if (!WriteHeader()) 122 if (!WriteHeader())
123 return false; 123 return false;
124 124
125 std::string codec_name; 125 const char* codec_name =
126 switch (codec_type_) { 126 CodecTypeToPayloadName(codec_type_).value_or("Unknown");
127 case kVideoCodecVP8:
128 codec_name = "VP8";
129 break;
130 case kVideoCodecVP9:
131 codec_name = "VP9";
132 break;
133 case kVideoCodecH264:
134 codec_name = "H264";
135 break;
136 default:
137 codec_name = "Unknown";
138 }
139 LOG(LS_WARNING) << "Created IVF file for codec data of type " << codec_name 127 LOG(LS_WARNING) << "Created IVF file for codec data of type " << codec_name
140 << " at resolution " << width_ << " x " << height_ 128 << " at resolution " << width_ << " x " << height_
141 << ", using " << (using_capture_timestamps_ ? "1" : "90") 129 << ", using " << (using_capture_timestamps_ ? "1" : "90")
142 << "kHz clock resolution."; 130 << "kHz clock resolution.";
143 return true; 131 return true;
144 } 132 }
145 133
146 bool IvfFileWriter::WriteFrame(const EncodedImage& encoded_image, 134 bool IvfFileWriter::WriteFrame(const EncodedImage& encoded_image,
147 VideoCodecType codec_type) { 135 VideoCodecType codec_type) {
148 if (!file_.IsOpen()) 136 if (!file_.IsOpen())
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 file_.Close(); 191 file_.Close();
204 return true; 192 return true;
205 } 193 }
206 194
207 bool ret = WriteHeader(); 195 bool ret = WriteHeader();
208 file_.Close(); 196 file_.Close();
209 return ret; 197 return ret;
210 } 198 }
211 199
212 } // namespace webrtc 200 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698