Commit c9c8c7e1 authored by Moto Hira's avatar Moto Hira Committed by Facebook GitHub Bot
Browse files

Move I/O logging to C++ (#3123)

Summary:
Pull Request resolved: https://github.com/pytorch/audio/pull/3123

Moving the I/O usage logging to C++, so that C++ usages are also covered.

Reviewed By: nateanl

Differential Revision: D43686567

fbshipit-source-id: ad357028dd69eedb8bc2a2482fe07e95757a3a62
parent 6a4a8200
...@@ -52,6 +52,7 @@ AVFormatContext* get_input_format_context( ...@@ -52,6 +52,7 @@ AVFormatContext* get_input_format_context(
} // namespace } // namespace
StreamReader::StreamReader(AVFormatContext* p) : pFormatContext(p) { StreamReader::StreamReader(AVFormatContext* p) : pFormatContext(p) {
C10_LOG_API_USAGE_ONCE("torchaudio.io.StreamReader");
int ret = avformat_find_stream_info(pFormatContext, nullptr); int ret = avformat_find_stream_info(pFormatContext, nullptr);
TORCH_CHECK( TORCH_CHECK(
ret >= 0, "Failed to find stream information: ", av_err2string(ret)); ret >= 0, "Failed to find stream information: ", av_err2string(ret));
......
...@@ -40,7 +40,9 @@ AVFormatContext* get_output_format_context( ...@@ -40,7 +40,9 @@ AVFormatContext* get_output_format_context(
} }
} // namespace } // namespace
StreamWriter::StreamWriter(AVFormatContext* p) : pFormatContext(p) {} StreamWriter::StreamWriter(AVFormatContext* p) : pFormatContext(p) {
C10_LOG_API_USAGE_ONCE("torchaudio.io.StreamWriter");
}
StreamWriter::StreamWriter( StreamWriter::StreamWriter(
AVIOContext* io_ctx, AVIOContext* io_ctx,
......
...@@ -429,7 +429,6 @@ class StreamReader: ...@@ -429,7 +429,6 @@ class StreamReader:
option: Optional[Dict[str, str]] = None, option: Optional[Dict[str, str]] = None,
buffer_size: int = 4096, buffer_size: int = 4096,
): ):
torch._C._log_api_usage_once("torchaudio.io.StreamReader")
if isinstance(src, str): if isinstance(src, str):
self._be = torchaudio.lib._torchaudio_ffmpeg.StreamReader(src, format, option) self._be = torchaudio.lib._torchaudio_ffmpeg.StreamReader(src, format, option)
elif hasattr(src, "read"): elif hasattr(src, "read"):
......
...@@ -109,7 +109,6 @@ class StreamWriter: ...@@ -109,7 +109,6 @@ class StreamWriter:
format: Optional[str] = None, format: Optional[str] = None,
buffer_size: int = 4096, buffer_size: int = 4096,
): ):
torch._C._log_api_usage_once("torchaudio.io.StreamWriter")
if isinstance(dst, str): if isinstance(dst, str):
self._s = torchaudio.lib._torchaudio_ffmpeg.StreamWriter(dst, format) self._s = torchaudio.lib._torchaudio_ffmpeg.StreamWriter(dst, format)
elif hasattr(dst, "write"): elif hasattr(dst, "write"):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment