Skip to content

Commit afdca1f

Browse files
committed
Use std::unique_ptr to create DeviceInterface
Signed-off-by: Dmitry Rogozhkin <[email protected]>
1 parent 0143d4e commit afdca1f

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/torchcodec/_core/DeviceInterface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ bool registerDeviceInterface(
3636
return true;
3737
}
3838

39-
std::shared_ptr<DeviceInterface> createDeviceInterface(
39+
std::unique_ptr<DeviceInterface> createDeviceInterface(
4040
const std::string device) {
4141
// TODO: remove once DeviceInterface for CPU is implemented
4242
if (device == "cpu") {
@@ -50,7 +50,7 @@ std::shared_ptr<DeviceInterface> createDeviceInterface(
5050
"Unsupported device: ",
5151
device);
5252

53-
return std::shared_ptr<DeviceInterface>(g_interface_map[deviceType](device));
53+
return std::unique_ptr<DeviceInterface>(g_interface_map[deviceType](device));
5454
}
5555

5656
} // namespace facebook::torchcodec

src/torchcodec/_core/DeviceInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ bool registerDeviceInterface(
5959
const std::string deviceType,
6060
const CreateDeviceInterfaceFn createInterface);
6161

62-
std::shared_ptr<DeviceInterface> createDeviceInterface(
62+
std::unique_ptr<DeviceInterface> createDeviceInterface(
6363
const std::string device);
6464

6565
} // namespace facebook::torchcodec

test/VideoDecoderTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// LICENSE file in the root directory of this source tree.
66

77
#include "src/torchcodec/_core/AVIOBytesContext.h"
8+
#include "src/torchcodec/_core/DeviceInterface.h"
89
#include "src/torchcodec/_core/SingleStreamDecoder.h"
910

1011
#include <c10/util/Flags.h>

0 commit comments

Comments
 (0)